From 7e1eaee616365799cfc4cc787fdaa9448958536b Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Wed, 20 Oct 2021 14:21:06 -0700 Subject: Feat: now execs instead of exec + fork if going to exit. One quick solution to the lack of tracking deep into the command line is to note that the pattern of code emitted for an async is: Xasync |__ child (command) |__ parent (continues) The child creates a process group, as described before. If the child is a simple command, we will now "exec" as it will exit immediately after the command. This gives us the correct behavior, at least for simple cases. This also fixed pipes. However, if child has to be forked, i.e. can't be immediately execed, then I don't think this process works... --- sys/cmd/rc/lex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/cmd/rc/lex.c') diff --git a/sys/cmd/rc/lex.c b/sys/cmd/rc/lex.c index 373edd5..eb3a268 100644 --- a/sys/cmd/rc/lex.c +++ b/sys/cmd/rc/lex.c @@ -209,7 +209,7 @@ yylex(void) node->type = Tpipe; node->redir.fd[0] = 1; - node->redir.fd[1] = 1; + node->redir.fd[1] = 0; goto redir; case '>': -- cgit v1.2.1