Skip to content

Commit 7440c1b

Browse files
committed
panic on signal
1 parent 97ff3f8 commit 7440c1b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

crates/cuda_builder/src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,23 @@ impl CudaBuilder {
378378
.expect("Failed to run ptxas");
379379
println!("cargo:warning=PTXAS output: {:?}", ptxas_output);
380380
if !ptxas_output.status.success() {
381-
panic!("ptxas failed with exit code: {:?}", ptxas_output.status.code());
381+
match ptxas_output.status.code() {
382+
Some(code) => panic!("ptxas failed with exit code: {code}"),
383+
None => {
384+
// Process was terminated by a signal
385+
#[cfg(unix)]
386+
{
387+
use std::os::unix::process::ExitStatusExt;
388+
if let Some(signal) = ptxas_output.status.signal() {
389+
panic!("ptxas was killed by signal: {signal}");
390+
} else {
391+
panic!("ptxas failed with unknown signal");
392+
}
393+
}
394+
#[cfg(not(unix))]
395+
panic!("ptxas failed with signal");
396+
},
397+
}
382398
}
383399

384400
if let Some(copy_path) = &self.ptx_file_copy_path {

0 commit comments

Comments
 (0)