How to pipe a string argument to an executable launched with Apache Commons Exec?
I need to pipe a text argument to the stdin of a command launched with Apache Commons Exec (for the curious, the command is gpg and the argument is the passphrase to the keystore; gpg does not have an argument to provide the passphrase explicitly, only to accept it from stdin). In addition, I need this to support both Linux and Windows. In a shell script I'd do cat mypassphrase|gpg --passphrase-fd or type mypassphrase|gpg --passphrase-fd but type doesn't work on Windows as it's not an executable but a command built into the command interpreted (cmd.exe). The code not working (for the above