Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8062638

Nashorn: RuntimeException when run command from js with -scripting on Cygwin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u40, 8u45, 9
    • core-libs
    • Cygwin

    • b42
    • generic
    • windows

        For reproduce, please, run this code on Cygwin
        $ jjs -scripting test.js
        Current dir : C:\cygwin64\home\sqe\work\8u40\nashorn

        Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Cannot run program "notepad" (in directory "\home\sqe\work\8u40\nashorn"): CreateProcess error=267, The directory name is invalid
                at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:391)
                at jdk.nashorn.tools.Shell.apply(Shell.java:394)
                at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
                at jdk.nashorn.tools.Shell.run(Shell.java:169)
                at jdk.nashorn.tools.Shell.main(Shell.java:133)
                at jdk.nashorn.tools.Shell.main(Shell.java:112)
        Caused by: java.io.IOException: Cannot run program "notepad" (in directory "\home\sqe\work\8u40\nashorn"): CreateProcess error=267, The directory name is invalid
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
                at jdk.nashorn.internal.runtime.ScriptingFunctions.exec(ScriptingFunctions.java:166)
                at jdk.nashorn.internal.scripts.Script$test.:program(test.js:7)
                at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
                at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
                at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:387)
                ... 5 more
        Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
                at java.lang.ProcessImpl.create(Native Method)
                at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
                at java.lang.ProcessImpl.start(ProcessImpl.java:137)
                at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
                ... 10 more


        Code:
        print("Current dir : " + java.lang.System.getProperty("user.dir"))

        print("")

        `notepad`

        if I run command from ProcessBuilder, exception will not reproduce :

        var pb = new java.lang.ProcessBuilder("notepad")
        var p = pb.start()
        p.waitFor()


              slugovoy Sergey Lugovoy (Inactive)
              slugovoy Sergey Lugovoy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: