diff options
author | 2017-10-13 14:00:47 +0200 | |
---|---|---|
committer | 2017-10-16 17:39:15 +0200 | |
commit | 90ea4d2b26f85bcfb7890f5ba218b4b051f1315b (patch) | |
tree | 74ac4ed840ad7d509c642febf74ab4593673c07d /src/main/java/com/google/devtools/build/lib | |
parent | b4a2034b77703b764304acb352325b06912ec279 (diff) |
Simplify the SpawnExecException constructor
Whether or not there was a catastrophic error is stored in the SpawnResult, so
we can just use that instead of passing in an additional boolean.
PiperOrigin-RevId: 172083752
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
4 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java index 64de06b29d..93b58ff7e2 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/AbstractSpawnStrategy.java @@ -114,8 +114,7 @@ public abstract class AbstractSpawnStrategy implements SandboxedSpawnActionConte spawn.getArguments(), spawn.getEnvironment(), cwd); - throw new SpawnExecException( - message, spawnResult, /*forciblyRunRemotely=*/false, /*catastrophe=*/false); + throw new SpawnExecException(message, spawnResult, /*forciblyRunRemotely=*/false); } return ImmutableSet.of(spawnResult); } diff --git a/src/main/java/com/google/devtools/build/lib/exec/SpawnExecException.java b/src/main/java/com/google/devtools/build/lib/exec/SpawnExecException.java index 041cff4551..a2dc5d0ced 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/SpawnExecException.java +++ b/src/main/java/com/google/devtools/build/lib/exec/SpawnExecException.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.lib.exec; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.devtools.build.lib.actions.Action; import com.google.devtools.build.lib.actions.ActionExecutionException; @@ -30,12 +31,14 @@ public class SpawnExecException extends ExecException { protected final SpawnResult result; protected final boolean forciblyRunRemotely; - public SpawnExecException(String message, SpawnResult result, boolean catastrophe) { - super(message, catastrophe); + public SpawnExecException( + String message, SpawnResult result, boolean forciblyRunRemotely) { + super(message, result.isCatastrophe()); this.result = Preconditions.checkNotNull(result); - this.forciblyRunRemotely = false; + this.forciblyRunRemotely = forciblyRunRemotely; } + @VisibleForTesting public SpawnExecException( String message, SpawnResult result, boolean forciblyRunRemotely, boolean catastrophe) { super(message, catastrophe); diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java index 9e8288fa82..dbfea08cd8 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java @@ -251,6 +251,7 @@ class RemoteSpawnRunner implements SpawnRunner { .setExitCode(ExitCode.REMOTE_ERROR.getNumericExitCode()) .setStatus(status) .build(), + /* forciblyRunRemotely= */ false, /* catastrophe= */ true); } diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java index 0df062e441..7eac6bb6be 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/AbstractSandboxSpawnRunner.java @@ -116,8 +116,7 @@ abstract class AbstractSandboxSpawnRunner implements SpawnRunner { originalSpawn.getEnvironment(), execRoot.getPathString()) + SANDBOX_DEBUG_SUGGESTION; } - throw new SpawnExecException( - message, result, /*forciblyRunRemotely=*/false, /*catastrophe=*/false); + throw new SpawnExecException(message, result, /*forciblyRunRemotely=*/false); } return result; } finally { |