~emersion/mrsh

ad888781b76b56a29c9f8cd06b8e1c521a152d50 — Simon Ser 5 months ago 83a80e0
shell/task/simple_command: return 127 on command not found
2 files changed, 5 insertions(+), 1 deletions(-)

M shell/task/simple_command.c
M test/pipeline.sh
M shell/task/simple_command.c => shell/task/simple_command.c +1 -1
@@ 49,7 49,7 @@ static int run_process(struct mrsh_context *ctx, struct mrsh_simple_command *sc,
	const char *path = expand_path(ctx->state, argv[0], true, false);
	if (!path) {
		fprintf(stderr, "%s: not found\n", argv[0]);
		return TASK_STATUS_ERROR;
		return 127;
	}

	pid_t pid = fork();

M test/pipeline.sh => test/pipeline.sh +4 -0
@@ 13,6 13,10 @@ echo "Pipeline with bang"
! false
echo $?

echo "Pipeline with unknown command"
idontexist
echo $? # 127

# https://github.com/emersion/mrsh/issues/100
echo "Pipeline with subshell"
(echo "a b"; echo "c d") | sed s/c/C/