From 7ad28c3a970673a243e1ce20a3b3622875c575a0 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Mon, 16 Dec 2019 08:36:48 -0600 Subject: [PATCH] Set exit status when running a command from `enter` --- yadm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yadm b/yadm index b5ce07e..3e4c964 100755 --- a/yadm +++ b/yadm @@ -939,8 +939,13 @@ function enter() { yadm_prompt="yadm shell ($YADM_REPO) $shell_path > " PROMPT="$yadm_prompt" PS1="$yadm_prompt" "$SHELL" $shell_opts "${shell_cmd[@]}" + return_code="$?" - [ "${#shell_cmd[@]}" -eq 0 ] && echo "Leaving yadm repo" + if [ "${#shell_cmd[@]}" -eq 0 ]; then + echo "Leaving yadm repo" + else + exit_with_hook "$return_code" + fi } function git_command() {