Development discussion for mrsh.

You can setup your Git repository like so:

git config sendemail.to ~emersion/mrsh-dev@lists.sr.ht
1 2

[PATCH] unspecified.c: don't abort in interactive shells

Details
Message ID
<20181229005549.26853-1-sir@cmpwn.com>
Sender timestamp
1546044949
DKIM signature
permerror
Download raw message
Patch: +9 -3
---
 builtin/unspecified.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/builtin/unspecified.c b/builtin/unspecified.c
index 43a2aed..74e4f27 100644
--- a/builtin/unspecified.c
@@ -5,7 +5,13 @@
 
 int builtin_unspecified(struct mrsh_state *state, int argc, char *argv[]) {
 	// Ref: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
-	fprintf(stderr, "%s: The behavior of this command is undefined. "
-			"This is an error in your script. Aborting.\n", argv[0]);
-	exit(1);
+	if (state->interactive) {
+		fprintf(stderr,
+				"%s: The behavior of this command is undefined.", argv[0]);
+		return 1;
+	} else {
+		fprintf(stderr, "%s: The behavior of this command is undefined. "
+				"This is an error in your script. Aborting.\n", argv[0]);
+		exit(1);
+	}
 }
-- 
2.20.1
Details
Message ID
<nxxNgLw8RHs9GLSJ_qKIcb55CxYsHDzTTIcv5seJUNDx8Rhfx-L0SVvmIaQCfFTLvhifLkaZt98-MeIW6gFq6pzee_6R71FYaaCRXeR4VdY=@emersion.fr>
In-Reply-To
<20181229005549.26853-1-sir@cmpwn.com> (view parent)
Sender timestamp
1546131905
DKIM signature
pass
Download raw message
Pushed, with a minor fix to use `state->exit` instead of exit(3).

To git.sr.ht:~emersion/mrsh
   8a39bf5..7fc12bb  master -> master

Thanks!