@@ -75,8 +75,7 @@ public static void main(String[] argsArray) throws Exception {
75
75
}
76
76
77
77
if (isWindows ()) {
78
- List <String > winCmd = prepareForWindows (cmd , env );
79
- System .out .println (join (" " , cmd ));
78
+ System .out .println (prepareForWindows (cmd , env ));
80
79
} else {
81
80
List <String > bashCmd = prepareForBash (cmd , env );
82
81
for (String c : bashCmd ) {
@@ -101,23 +100,18 @@ public static void main(String[] argsArray) throws Exception {
101
100
* The command is executed using "cmd /c" and formatted as single line, since that's the
102
101
* easiest way to consume this from a batch script (see spark-class2.cmd).
103
102
*/
104
- private static List < String > prepareForWindows (List <String > cmd , Map <String , String > childEnv ) {
103
+ private static String prepareForWindows (List <String > cmd , Map <String , String > childEnv ) {
105
104
StringBuilder cmdline = new StringBuilder ("cmd /c \" " );
106
105
for (Map .Entry <String , String > e : childEnv .entrySet ()) {
107
- if (cmdline .length () > 0 ) {
108
- cmdline .append (" " );
109
- }
110
106
cmdline .append (String .format ("set %s=%s" , e .getKey (), e .getValue ()));
111
- cmdline .append (" &&" );
107
+ cmdline .append (" && " );
112
108
}
113
109
for (String arg : cmd ) {
114
- if (cmdline .length () > 0 ) {
115
- cmdline .append (" " );
116
- }
117
110
cmdline .append (quoteForBatchScript (arg ));
111
+ cmdline .append (" " );
118
112
}
119
113
cmdline .append ("\" " );
120
- return Arrays . asList ( cmdline .toString () );
114
+ return cmdline .toString ();
121
115
}
122
116
123
117
/**
0 commit comments