Tolerate InterruptedException when retrieving a target from the graph. Even if the target is present, the evaluation can still be interrupted.
This was present from the beginning in unknown commit, I should have caught it then.
PiperOrigin-RevId: 294802500
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
index 6be15b3..c5e8b50 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java
@@ -714,9 +714,12 @@
Target target;
try {
target = env.getPackageManager().getTarget(env.getReporter(), configuredTarget.getLabel());
- } catch (NoSuchTargetException | NoSuchPackageException | InterruptedException e) {
+ } catch (InterruptedException e) {
+ env.getReporter().handle(Event.error("interrupted"));
+ return ExitCode.INTERRUPTED;
+ } catch (NoSuchTargetException | NoSuchPackageException e) {
env.getReporter().handle(Event.error("Failed to find a target to validate. " + e));
- throw new IllegalStateException("Failed to find a target to validate");
+ throw new IllegalStateException("Failed to find a target to validate", e);
}
String targetError = validateTarget(target);