From cfd8ed745a420c8b842610b33f2e2edf8a06e93c Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 25 Jun 2020 11:03:51 -0400 Subject: cmd/shell: Return exit status --- diff --git a/NEWS b/NEWS index 8299e5e..a6d3cc0 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Changes in this release: * "prokit build" now passes an "-a" option, if supported, to opkg to install host-architecture non-coinstallable dependencies (such as library development packages) when cross building. + * "prokit shell" now returns the shell's exit status. ProteanOS Development Kit version 2.0.1 --------------------------------------- diff --git a/src/cmd/shell.sh b/src/cmd/shell.sh index 0c5a7b0..2cc53ad 100644 --- a/src/cmd/shell.sh +++ b/src/cmd/shell.sh @@ -22,6 +22,7 @@ cmd_shell_main() { local root= local dev= + local es= if [ ${#} -lt 1 ]; then print_cmd_usage 'shell' >&2 @@ -48,18 +49,19 @@ cmd_shell_main() [ "x${dev}" != 'x' ] && block_umount "${root}" return 2 fi + es=0 if [ ${#} -eq 0 ]; then - session_exec /bin/sh + session_exec /bin/sh || es=${?} printf '\n' info "$(get_msg 'cmd_shell_exiting')" else - session_exec "${@}" + session_exec "${@}" || es=${?} fi session_end [ "x${dev}" != 'x' ] && block_umount "${root}" - return 0 + return ${es} } cmd_shell_register() -- cgit v0.9.1