about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Nordholts <martin.nordholts@codetale.se>2025-07-04 13:10:34 +0200
committerMartin Nordholts <martin.nordholts@codetale.se>2025-07-04 20:44:26 +0200
commit148a220e38f0b2ba4ec8014d0c1e83ca6d52d47e (patch)
tree792fe88508e79d4144bb04ce75e1d03954dad5bb
parent0c4fa2690de945f062668acfc36b3f8cfbd013e2 (diff)
downloadrust-148a220e38f0b2ba4ec8014d0c1e83ca6d52d47e.tar.gz
rust-148a220e38f0b2ba4ec8014d0c1e83ca6d52d47e.zip
remote-test-client: Exit code `128 + <signal-number>` instead of `3`
If the remote process is terminated by a signal, make `remote-test-client` exit
with the code `128 + <signal-number>` instead of always `3`. This follows common
practice among tools such as bash [^1]:

> When a command terminates on a fatal signal whose number is N, Bash uses the
> value 128+N as the exit status.

It also allows us to differentiate between `run-pass` and `run-crash` ui tests
without special case code in compiletest for that when `remote-test-client` is
used.

[^1]: https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
-rw-r--r--src/tools/remote-test-client/src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs
index bda08423487..b9741431b50 100644
--- a/src/tools/remote-test-client/src/main.rs
+++ b/src/tools/remote-test-client/src/main.rs
@@ -335,7 +335,9 @@ fn run(support_lib_count: usize, exe: String, all_args: Vec<String>) {
         std::process::exit(code);
     } else {
         println!("died due to signal {}", code);
-        std::process::exit(3);
+        // Behave like bash and other tools and exit with 128 + the signal
+        // number. That way we can avoid special case code in other places.
+        std::process::exit(128 + code);
     }
 }