From 18cfcd41a0b3f412f1b4add04a832e6acf4b961d Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Sat, 5 Aug 2017 23:01:12 +0200 Subject: [PATCH] CapturingProcessHandler.runProcess and runProcessWithProgressIndicator now both accept 0 and -1 to run indefinitely context: Cancelable readVersion and CMake copying on Cygwin: CPP-8893 Configurable list of toolsets that include environment + CPP-10116 Allow selecting different toolsets/cmake/debugger for different projects/cmake configurations --- .../execution/process/CapturingProcessHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java index 7e3b67142f79..dbc11b463a53 100644 --- a/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/CapturingProcessHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,6 +99,7 @@ public class CapturingProcessHandler extends OSProcessHandler { * @param destroyOnTimeout whether to kill the process after timeout passes */ public ProcessOutput runProcess(int timeoutInMilliseconds, boolean destroyOnTimeout) { + // keep in sync with runProcessWithProgressIndicator if (timeoutInMilliseconds <= 0) { return runProcess(); } @@ -124,7 +125,7 @@ public class CapturingProcessHandler extends OSProcessHandler { @NotNull public ProcessOutput runProcessWithProgressIndicator(@NotNull ProgressIndicator indicator) { - return runProcessWithProgressIndicator(indicator, Integer.MAX_VALUE); + return runProcessWithProgressIndicator(indicator, -1); } @NotNull @@ -134,6 +135,11 @@ public class CapturingProcessHandler extends OSProcessHandler { @NotNull public ProcessOutput runProcessWithProgressIndicator(@NotNull ProgressIndicator indicator, int timeoutInMilliseconds, boolean destroyOnTimeout) { + // keep in sync with runProcess + if (timeoutInMilliseconds <= 0) { + timeoutInMilliseconds = Integer.MAX_VALUE; + } + final int WAIT_INTERVAL = 100; int waitingTime = 0; boolean setExitCode = true;