From c03ee8a9b6eeecc06e11961cdb609baae28382e3 Mon Sep 17 00:00:00 2001 From: Pin Date: Fri, 12 Apr 2024 22:57:35 -0400 Subject: [PATCH] fixing ctrl+d error --- cmd/shell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/shell.c b/cmd/shell.c index 43c5675..a08cbfb 100644 --- a/cmd/shell.c +++ b/cmd/shell.c @@ -15,6 +15,11 @@ int main() { do { cmd = read_input(); + // CTRL+D will set cmd to null + // Shell should exit if encountered + if (cmd == NULL) { + exit(EXIT_FAILURE); + } args = split_cmd(cmd); status_return = reverse_execute(args);