Fix NonInteractiveShellRunner for empty args

- Fix issue when empty args resulted runner to
  think it should handle this scenario effectively
  hijacking interactive mode.
- This bug were added by previous rework on #372
This commit is contained in:
Janne Valkealahti
2022-02-22 09:47:20 +00:00
parent 0a074b37e4
commit 114dbeccaa
2 changed files with 42 additions and 3 deletions

View File

@@ -58,14 +58,14 @@ public class NonInteractiveShellRunner implements ShellRunner {
private Parser lineParser;
private Function<ApplicationArguments, List<String>> commandsFromInputArgs;
private Function<ApplicationArguments, List<String>> commandsFromInputArgs = args -> args
.getSourceArgs().length == 0 ? Collections.emptyList()
: Collections.singletonList(String.join(" ", args.getSourceArgs()));
public NonInteractiveShellRunner(Shell shell, ShellContext shellContext) {
this.shell = shell;
this.shellContext = shellContext;
this.lineParser = new DefaultParser();
this.commandsFromInputArgs = (args) ->
Collections.singletonList(String.join(" ", args.getSourceArgs()));
}
/**