From 8664c58dd3ca7bd6688eb473cc026a263f66ab51 Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Mon, 11 Jul 2016 09:21:25 +0300 Subject: [PATCH] fixed couple cases when update doesn't work (win specific). IDEA-CR-12103. --- platform/util/src/com/intellij/util/Restarter.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java index 4c0d664e5e82..eccaf594f4e9 100644 --- a/platform/util/src/com/intellij/util/Restarter.java +++ b/platform/util/src/com/intellij/util/Restarter.java @@ -113,7 +113,7 @@ public class Restarter { final int pid = kernel32.GetCurrentProcessId(); final IntByReference argc = new IntByReference(); Pointer argv_ptr = shell32.CommandLineToArgvW(kernel32.GetCommandLineW(), argc); - final String[] argv = argv_ptr.getWideStringArray(0, argc.getValue()); + final String[] argv = getRestartArgv(argv_ptr.getWideStringArray(0, argc.getValue())); kernel32.LocalFree(argv_ptr); doScheduleRestart(new File(PathManager.getBinPath(), "restarter.exe"), new Consumer>() { @@ -153,10 +153,6 @@ public class Restarter { if (argv[i].endsWith("com.intellij.idea.Main") || argv[i].endsWith(".exe")) { countArgs = i + 1; - if ("0".equals(argv[2])) { - // update number of args in according with removed cmd line args - argv[3] = String.valueOf(Integer.valueOf(argv[3]) - (argv.length - (i+1))); - } if (argv[i].endsWith(".exe") && argv[i].indexOf(File.separator) < 0) { //absolute path argv[i] = new File(PathManager.getBinPath(), argv[i]).getPath(); @@ -173,8 +169,7 @@ public class Restarter { List commands = new ArrayList(); commands.add(createTempExecutable(restarterFile).getPath()); argumentsBuilder.consume(commands); - String[] argv = getRestartArgv(ArrayUtil.toStringArray(commands)); - Runtime.getRuntime().exec(argv); + Runtime.getRuntime().exec(ArrayUtil.toStringArray(commands)); } public static String getRestarterDir() {