diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-08 11:48:01 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-08 11:48:01 +0200 |
| commit | d14a49d89c21a2f1dfccbefae22f45efc832c79e (patch) | |
| tree | aa7085e8183a5d12922920a96e02bbf12e46a34c | |
| parent | ddf0ba22e163112ab032e04d2a93e2f0a73bab36 (diff) | |
| download | rust-d14a49d89c21a2f1dfccbefae22f45efc832c79e.tar.gz rust-d14a49d89c21a2f1dfccbefae22f45efc832c79e.zip | |
Add documentation about why we use `exec`
| -rw-r--r-- | build_system/src/rust_tools.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/build_system/src/rust_tools.rs b/build_system/src/rust_tools.rs index 7a0c5962919..7e3e37a30a8 100644 --- a/build_system/src/rust_tools.rs +++ b/build_system/src/rust_tools.rs @@ -99,6 +99,10 @@ impl RustcTools { fn exec(input: &[&dyn AsRef<OsStr>], env: &HashMap<String, String>) -> Result<(), String> { #[cfg(unix)] { + // We use `exec` to call the `execvp` syscall instead of creating a new process where the + // command will be executed because very few signals can actually kill a current process, + // so if segmentation fault (SIGSEGV signal) happens and we raise to the current process, + // it will simply do nothing and we won't have the nice error message for the shell. let error = crate::utils::get_command_inner(input, None, Some(env)).exec(); eprintln!("execvp syscall failed: {error:?}"); std::process::exit(1); |
