Github user tsudukim commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5227#discussion_r27645187
  
    --- Diff: launcher/src/main/java/org/apache/spark/launcher/Main.java ---
    @@ -101,12 +101,9 @@ public static void main(String[] argsArray) throws 
Exception {
        * The method quotes all arguments so that spaces are handled as 
expected. Quotes within arguments
        * are "double quoted" (which is batch for escaping a quote). This page 
has more details about
        * quoting and other batch script fun stuff: 
http://ss64.com/nt/syntax-esc.html
    -   *
    -   * The command is executed using "cmd /c" and formatted in single line, 
since that's the
    -   * easiest way to consume this from a batch script (see 
spark-class2.cmd).
        */
       private static String prepareWindowsCommand(List<String> cmd, 
Map<String, String> childEnv) {
    -    StringBuilder cmdline = new StringBuilder("cmd /c \"");
    +    StringBuilder cmdline = new StringBuilder("");
    --- End diff --
    
    Why we are using `cmd.exe /c` in existing *.cmd is that the environment 
would be polluted by the executing commands.
    But we already have *2.cmd and *.cmd calls *2.cmd by `cmd.exe /c`, so I 
think we don't need another `cmd.exe /c` when execute java.exe.
    Rather, if we use `cmd.exe /c`, we face another problem.
    We should execute like this command:
      `"C:\Program Files\Java\jdk1.7.0_67\bin\java.exe" -cp 
"C:\path\to\somewhere\;..." org.apache.spark.deploy.SparkSubmit ...`
    But the Launcher returns this string:
      `cmd.exe /c ""C:\Program Files\Java\jdk1.7.0_67\bin\java.exe" -cp 
"C:\path\to\somewhere\;..." org.apache.spark.deploy.SparkSubmit ..."`
    `cmd.exe /c` needs double-quoted command string, but the java.exe path and 
other arguments might be already double-quoted, so it the returned string is 
weird.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to