mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
run targets: support run.processes.with.redirectedErrorStream registry key (IDEA-282942)
GitOrigin-RevId: 78cb5bb5f05e1fad8690be69e8ad9677b8a94909
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bdb8b64efd
commit
3cd5f78b5f
@@ -32,19 +32,22 @@ public final class TargetedCommandLine {
|
||||
@NotNull private final Charset myCharset;
|
||||
private final @NotNull List<? extends TargetValue<String>> myParameters;
|
||||
@NotNull private final Map<String, TargetValue<String>> myEnvironment;
|
||||
private final boolean myRedirectErrorStream;
|
||||
|
||||
public TargetedCommandLine(@NotNull TargetValue<String> exePath,
|
||||
@NotNull TargetValue<String> workingDirectory,
|
||||
@NotNull TargetValue<String> inputFilePath,
|
||||
@NotNull Charset charset,
|
||||
@NotNull List<? extends TargetValue<String>> parameters,
|
||||
@NotNull Map<String, TargetValue<String>> environment) {
|
||||
TargetedCommandLine(@NotNull TargetValue<String> exePath,
|
||||
@NotNull TargetValue<String> workingDirectory,
|
||||
@NotNull TargetValue<String> inputFilePath,
|
||||
@NotNull Charset charset,
|
||||
@NotNull List<? extends TargetValue<String>> parameters,
|
||||
@NotNull Map<String, TargetValue<String>> environment,
|
||||
boolean redirectErrorStream) {
|
||||
myExePath = exePath;
|
||||
myWorkingDirectory = workingDirectory;
|
||||
myInputFilePath = inputFilePath;
|
||||
myCharset = charset;
|
||||
myParameters = parameters;
|
||||
myEnvironment = environment;
|
||||
myRedirectErrorStream = redirectErrorStream;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,6 +113,10 @@ public final class TargetedCommandLine {
|
||||
return myCharset;
|
||||
}
|
||||
|
||||
public boolean isRedirectErrorStream() {
|
||||
return myRedirectErrorStream;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String resolvePromise(@NotNull Promise<String> promise, @NotNull String debugName)
|
||||
throws ExecutionException {
|
||||
|
||||
+12
-1
@@ -3,6 +3,7 @@ package com.intellij.execution.target;
|
||||
|
||||
import com.intellij.execution.target.value.TargetValue;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -22,6 +23,7 @@ public class TargetedCommandLineBuilder extends UserDataHolderBase {
|
||||
@NotNull private final Set<File> myFilesToDeleteOnTermination = new HashSet<>();
|
||||
|
||||
@NotNull private final TargetEnvironmentRequest myRequest;
|
||||
private boolean myRedirectErrorStream = false;
|
||||
|
||||
public TargetedCommandLineBuilder(@NotNull TargetEnvironmentRequest request) {
|
||||
myRequest = request;
|
||||
@@ -39,7 +41,8 @@ public class TargetedCommandLineBuilder extends UserDataHolderBase {
|
||||
myInputFilePath,
|
||||
myCharset,
|
||||
new ArrayList<>(myParameters),
|
||||
new HashMap<>(myEnvironment));
|
||||
new HashMap<>(myEnvironment),
|
||||
myRedirectErrorStream);
|
||||
}
|
||||
|
||||
public void setCharset(@NotNull Charset charset) {
|
||||
@@ -123,4 +126,12 @@ public class TargetedCommandLineBuilder extends UserDataHolderBase {
|
||||
public Set<File> getFilesToDeleteOnTermination() {
|
||||
return myFilesToDeleteOnTermination;
|
||||
}
|
||||
|
||||
public void setRedirectErrorStreamFromRegistry() {
|
||||
setRedirectErrorStream(Registry.is("run.processes.with.redirectedErrorStream", false));
|
||||
}
|
||||
|
||||
public void setRedirectErrorStream(boolean redirectErrorStream) {
|
||||
myRedirectErrorStream = redirectErrorStream;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ public class LocalTargetEnvironment extends TargetEnvironment implements TargetE
|
||||
generalCommandLine.withWorkDirectory(workingDirectory);
|
||||
}
|
||||
generalCommandLine.withEnvironment(commandLine.getEnvironmentVariables());
|
||||
generalCommandLine.setRedirectErrorStream(commandLine.isRedirectErrorStream());
|
||||
return generalCommandLine;
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
|
||||
@@ -192,6 +192,7 @@ class JdkCommandLineSetup(private val request: TargetEnvironmentRequest) {
|
||||
setupWorkingDirectory(javaParameters)
|
||||
setupEnvironment(javaParameters)
|
||||
setupClasspathAndParameters(javaParameters)
|
||||
commandLine.setRedirectErrorStreamFromRegistry()
|
||||
}
|
||||
|
||||
@Throws(CantRunException::class)
|
||||
|
||||
Reference in New Issue
Block a user