JDK-8130127 : streamline input parameter of Nashorn scripting $EXEC function
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-06-30
  • Updated: 2016-10-13
  • Resolved: 2015-07-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u112Fixed 9 b72Fixed
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.