I've tried looking into process builder, but I'm not sure how to source the bash environment into the process.
For example I'm using the following to launch my process:
Process p = new ProcessBuilder(args).start();
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
And I'd like my standard shell environment (from /etc/profile, .bashrc, etc.) sourced to the process.
Sorry if I'm not using the right terms - still learning java.
Thanks in advance for any help!
You need to set up a shell invocation with ProcessBuilder. Execute a command like:
/bin/bash -l -c "The entire command line that you want to execute"
When constructing theProcessBuilder pay attention to pass the command to execute as one unified string, e.g:
new ProcessBuilder("bash", "-l", "-c", "ps ax")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With