commit e871f45282929e6c7fb6c4305ab9a6e61ff68bbd
parent 1d28d9ebd63b4d17eca29beafdbe711fee836da3
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 4 Feb 2023 01:25:23 -0500
os::exec+linux: use signal name in exitstr
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/os/exec/process+freebsd.ha b/os/exec/process+freebsd.ha
@@ -167,7 +167,8 @@ export fn exitstr(status: exit_status) const str = {
i: int);
};
case let s: signaled =>
- // TODO: Add signal name
+ // TODO: Add signal name (once unix::signal is ported to
+ // FreeBSD)
return fmt::bsprintf(buf, "exited with signal {}", s: int);
};
};
diff --git a/os/exec/process+linux.ha b/os/exec/process+linux.ha
@@ -5,6 +5,7 @@
use errors;
use rt;
use fmt;
+use unix::signal;
// Stores information about a child process.
export type process = int;
@@ -153,8 +154,8 @@ export fn exitstr(status: exit_status) const str = {
i: int);
};
case let s: signaled =>
- // TODO: Add signal name
- return fmt::bsprintf(buf, "exited with signal {}", s: int);
+ return fmt::bsprintf(buf, "exited with signal {}",
+ signal::signame(s));
};
};
diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib
@@ -1174,7 +1174,8 @@ os_exec() {
process+linux.ha \
types.ha \
cmd.ha
- gen_ssa -plinux os::exec os strings fmt errors unix rt io ascii
+ gen_ssa -plinux os::exec os strings fmt errors unix rt io ascii \
+ unix::signal
gen_srcs -pfreebsd os::exec \
exec+freebsd.ha \
diff --git a/stdlib.mk b/stdlib.mk
@@ -1801,7 +1801,7 @@ stdlib_os_exec_linux_srcs = \
$(STDLIB)/os/exec/types.ha \
$(STDLIB)/os/exec/cmd.ha
-$(HARECACHE)/os/exec/os_exec-linux.ssa: $(stdlib_os_exec_linux_srcs) $(stdlib_rt) $(stdlib_os_$(PLATFORM)) $(stdlib_strings_$(PLATFORM)) $(stdlib_fmt_$(PLATFORM)) $(stdlib_errors_$(PLATFORM)) $(stdlib_unix_$(PLATFORM)) $(stdlib_rt_$(PLATFORM)) $(stdlib_io_$(PLATFORM)) $(stdlib_ascii_$(PLATFORM))
+$(HARECACHE)/os/exec/os_exec-linux.ssa: $(stdlib_os_exec_linux_srcs) $(stdlib_rt) $(stdlib_os_$(PLATFORM)) $(stdlib_strings_$(PLATFORM)) $(stdlib_fmt_$(PLATFORM)) $(stdlib_errors_$(PLATFORM)) $(stdlib_unix_$(PLATFORM)) $(stdlib_rt_$(PLATFORM)) $(stdlib_io_$(PLATFORM)) $(stdlib_ascii_$(PLATFORM)) $(stdlib_unix_signal_$(PLATFORM))
@printf 'HAREC \t$@\n'
@mkdir -p $(HARECACHE)/os/exec
@HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) -o $@ -Nos::exec \
@@ -4061,7 +4061,7 @@ testlib_os_exec_linux_srcs = \
$(STDLIB)/os/exec/types.ha \
$(STDLIB)/os/exec/cmd.ha
-$(TESTCACHE)/os/exec/os_exec-linux.ssa: $(testlib_os_exec_linux_srcs) $(testlib_rt) $(testlib_os_$(PLATFORM)) $(testlib_strings_$(PLATFORM)) $(testlib_fmt_$(PLATFORM)) $(testlib_errors_$(PLATFORM)) $(testlib_unix_$(PLATFORM)) $(testlib_rt_$(PLATFORM)) $(testlib_io_$(PLATFORM)) $(testlib_ascii_$(PLATFORM))
+$(TESTCACHE)/os/exec/os_exec-linux.ssa: $(testlib_os_exec_linux_srcs) $(testlib_rt) $(testlib_os_$(PLATFORM)) $(testlib_strings_$(PLATFORM)) $(testlib_fmt_$(PLATFORM)) $(testlib_errors_$(PLATFORM)) $(testlib_unix_$(PLATFORM)) $(testlib_rt_$(PLATFORM)) $(testlib_io_$(PLATFORM)) $(testlib_ascii_$(PLATFORM)) $(testlib_unix_signal_$(PLATFORM))
@printf 'HAREC \t$@\n'
@mkdir -p $(TESTCACHE)/os/exec
@HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) -o $@ -Nos::exec \