Skip to content

Commit a32b570

Browse files
authored
Rollup merge of rust-lang#143448 - Enselic:remote-test-client-signals, r=Mark-Simulacrum
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. See rust-lang#143002 and in particular rust-lang#143002 (comment). Exiting with code `3` has been done from the start (see rust-lang#39400) and seems arbitrary rather than a deliberate design decision, so changing it does not seem like an extraordinarily big deal. ### Regression testing Note that rust-lang#143002 will act as a regression test once it is rebased on this PR. ### Why a separate PR I think it is comforting to know that CI does not break with just this change. But if my reviewer prefers, we can move this commit to be part of rust-lang#143002 instead. [^1]: https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
2 parents 0f93385 + 148a220 commit a32b570

File tree

1 file changed

+3
-1
lines changed
  • src/tools/remote-test-client/src

1 file changed

+3
-1
lines changed

src/tools/remote-test-client/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,9 @@ fn run(support_lib_count: usize, exe: String, all_args: Vec<String>) {
335335
std::process::exit(code);
336336
} else {
337337
println!("died due to signal {}", code);
338-
std::process::exit(3);
338+
// Behave like bash and other tools and exit with 128 + the signal
339+
// number. That way we can avoid special case code in other places.
340+
std::process::exit(128 + code);
339341
}
340342
}
341343

0 commit comments

Comments
 (0)