-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pipe to standard input #1037
Comments
Unfortunately this is not yet supported. There's been a recent work in JLine making process input/output easier to handle so hopefully we're able to implement these features. |
Forgive my naivety, but why couldn't a simple It is fairly safe to assume that when using a pipe a program would be ran in not interactive mode, so could the following potentially be updated to read from Line 141 in c4e6cc9
I've got a crude local test and it works with the quickstart example: public void run(ApplicationArguments args) throws Exception {
shellContext.setInteractionMode(InteractionMode.NONINTERACTIVE);
args = mergePipeAndArgs(args);
List<String> commands = this.commandsFromInputArgs.apply(args);
...
}
private ApplicationArguments mergePipeAndArgs(ApplicationArguments args) {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
String[] mergedArgs = Stream.concat(Arrays.stream(args.getSourceArgs()), stdin.lines())
.toArray(String[]::new);
return new DefaultApplicationArguments(mergedArgs);
} |
Did a bit more playing around with the above and it doesn't play very nice piping file contents to it, for example YAML files get parsed broken because of some post processing |
Has some progress been made regarding piping input into a command? |
Hi,
I am trying to find out how to pipe to a commands standard input.
Taking the quick start example:
I would like to be able to achieve:
The text was updated successfully, but these errors were encountered: