Describe the bug
If you get a SEGFAULT in C, the run command output message is inconsistent.
STDOUT and STDERR being UB is acceptable I guess, but it really should notify the SEGFAULT if it's possible.
Apparently it is also inconsistent in CG, so it may be hard to fix.
To Reproduce
Write this C code in a tmp.c file at the root:
#include <stdio.h>
int main() {
printf("Before SEGFAULT\n");
fprintf(stderr, "STDERR Before SEGFAULT\n");
// This doesn't SEGFAULT in CG but it does for me... weird
// int seg[10];
// seg[11] = -1;
// This segfaults in CG but doesnt backtrace the faulty line
// int seg[10];
// seg[1000] = -1;
int *ptr = NULL;
*ptr = 10;
printf("After SEGFAULT\n");
fprintf(stderr, "STDERR After SEGFAULT\n");
return 0;
}
Load any clash, then run the command:
cargo run -- run --build-command "gcc -o tmp tmp.c" --command "./tmp"
Describe the bug If you get a SEGFAULT in C, the
run
command output message is inconsistent.STDOUT and STDERR being UB is acceptable I guess, but it really should notify the SEGFAULT if it's possible.
Apparently it is also inconsistent in CG, so it may be hard to fix.
To Reproduce Write this C code in a
tmp.c
file at the root:Load any clash, then run the command:
cargo run -- run --build-command "gcc -o tmp tmp.c" --command "./tmp"
Expected behavior![image](https://github.com/Andriamanitra/clash/assets/80173028/7232145e-acda-450c-a60d-250bbcbaed85)
What happens![image](https://github.com/Andriamanitra/clash/assets/80173028/d78e96a9-32bb-4f99-854d-a4c2c5771944)