Add generate script
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Jul 2009 18:18:06 +0000 (18:18 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Jul 2009 18:18:06 +0000 (18:18 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2826 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java

index 87a45905ac8ade9793bedb43c97e31428a89e145..d5470c8822a777504bd62735ea568eeb1f76723f 100644 (file)
@@ -193,20 +193,22 @@ public class SystemCall extends TreeSRelatedHelper implements Runnable,
                        throw new UnsupportedException();
                }
 
-               if (osConsole != null)
-                       commandLine = CommandLine.parse(osConsole + " "
-                                       + commandLine.toString());
-
                if (generateScript != null) {
                        File scriptFile = new File(getExecDirToUse() + File.separator
                                        + generateScript);
                        try {
-                               FileUtils.writeStringToFile(scriptFile, commandLine.toString());
+                               FileUtils.writeStringToFile(scriptFile,
+                                               (osConsole != null ? osConsole : "")
+                                                               + commandLine.toString());
                        } catch (IOException e) {
                                throw new SlcException("Could not generate script "
                                                + scriptFile, e);
                        }
                        commandLine = new CommandLine(scriptFile);
+               } else {
+                       if (osConsole != null)
+                               commandLine = CommandLine.parse(osConsole + " "
+                                               + commandLine.toString());
                }
 
                return commandLine;