| 8 | // `input` is null if we're running from a TTY, or a string of all stdin if |
| 9 | // running from the right-hand side of a pipe |
| 10 | const run = (input) => { |
| 11 | // Pass stdin to shx as the 'this' parameter |
| 12 | process.exitCode = shx.call(input, process.argv); |
| 13 | |
| 14 | // We use process.exitCode to ensure we don't terminate the process before |
| 15 | // streams finish. See: |
| 16 | // https://github.com/shelljs/shx/issues/85 |
| 17 | }; |
| 18 | |
| 19 | // ShellJS doesn't support input streams, so we have to collect all input first |
| 20 | if (shouldReadStdin(parsedArgs._)) { |