You need to pass the input stream in as the input
property of an object.
var inputStream = new java.io.FileInputStream("fileInput.txt");
runCommand("somescript.sh", { input: inputStream });
If input
is not an InputStream
it will be converted to a string and sent to the command directly. Similarly, you can add output
and/or err
properties to capture the command's standard output and standard error (documentation here).