fix(launch): should not create file when throwing CommandTooLongException. Closes #1606.

This commit is contained in:
huanghongxun 2022-08-29 00:03:35 +08:00
parent 08d7ff138b
commit a80fc34ef1

View File

@ -541,9 +541,6 @@ public class DefaultLauncher extends Launcher {
throw new IllegalArgumentException("The extension of " + scriptFile + " is not 'sh' or 'ps1' in macOS/Linux");
}
if (!FileUtils.makeFile(scriptFile))
throw new IOException("Script file: " + scriptFile + " cannot be created.");
final Command commandLine = generateCommandLine(nativeFolder);
final String command = usePowerShell ? null : commandLine.commandLine.toString();
@ -553,6 +550,9 @@ public class DefaultLauncher extends Launcher {
}
}
if (!FileUtils.makeFile(scriptFile))
throw new IOException("Script file: " + scriptFile + " cannot be created.");
OutputStream outputStream = new FileOutputStream(scriptFile);
Charset charset = StandardCharsets.UTF_8;