Nashorn's scripting mode supports $EXEC to run shell commands. The second argument to an invocation of $EXEC can be a string representing standard input. Currently, passing null or undefined will coerce these into strings, when they should logically represent "no input", as much as the empty string represents "empty input".
An OutputStreamWriter is currently created to pass on standard input to the external process. This is even the case when there is no input, and should be avoided.