CommandLine.parse
won't create a bash shell to interpret your pipe.
As described in "How to pipe a string argument to an executable launched with Apache Commons Exec?":
You cannot add a pipe argument (
|
) because the [here, in your case] 'git status
' command won't accept that.
It's the shell (e.g. bash) that interprets the pipe and does special processing when you type that commandline into the shell.
You should use a ByteArrayInputStream
to feed the outuput of one command to another;