a8c3473b1a
fix(norm): khais -> kcolin in headers
...
Closes #184
2025-04-30 11:29:20 +02:00
5ea55a9f9c
fix(builtin/exit): prevent leak when calling exit in a subprocess
2025-04-29 15:55:34 +02:00
93f3ea7c66
fix(exec): prevent leak when calling exit() in a subprocess
...
This was because at the point at which exit is called, we can only free a
t_simple_cmd, but not the whole t_cmd tree. This commit introduces a convention
of returning a t_subprocess enum from each function in exec. If the current
thread is a subprocess, SUBPROCESS is returned, else PARENTPROCESS. We also no
longer call exit in subproceses. This way, all processes bubble up to main,
where if SUBPROCESS is returned, all memory is freed and the program exits.
This also removes the previous should_exit convention.
Still TODO: handling of the exit builtin, which should also bubble up in the
same way.
2025-04-29 15:20:05 +02:00
d4da91b62b
fix(exec): do now swallow prompt and io on incorrect command followed by redirection
2025-04-28 16:07:08 +02:00
92d647e33c
feat(redirections): allow a command composed only of redirections
2025-04-28 14:44:20 +02:00
bd06d9f19c
refactor(std_fds): allow for ability to store multiple std fds savesets
2025-04-28 12:49:13 +02:00
505a96eeef
refactor(redirections): make handle_redirections generic over cmd types
2025-04-28 12:43:05 +02:00
29bbb5e572
fix(command_not_found): unset or empty PATH leads to No such file or directory error
2025-04-25 15:52:02 +02:00
ac198727e9
feat(postprocess): show error when post-processing failure occurs
2025-04-24 12:45:00 +02:00
2180909285
fix(expansion/wildcard): do not remove quotes twice on non-pattern strings
...
There is still an issue with removing too many quotes when expanding variables
(see #138 ). This will be tackled in a later PR.
2025-04-24 12:45:00 +02:00
2dd20b21bc
feat(redir): fieldsplit redir target, and handle ambiguous redirects
2025-04-24 12:44:33 +02:00
2ae001e00b
fix(exec/redirections): did not correctly restore fds when executing builtins
...
This caused redirections to keep stdout redirected to the outfile, which caused
problems with displaying the prmpt.
The shell hangs, but exits with C-d
Builtins affected:
echo hi > outfile
pwd > outfile
env > outfile
2025-04-18 14:14:43 +02:00
655ff36351
fix(susbt/variable): empty variables on their own are removed
2025-04-18 09:22:18 +02:00
5e6d7b3b4e
fix(parsing/here_doc): segfault & invalid fd & premature exit
2025-04-17 11:25:59 +02:00
733ae1093a
fix(exec): correctly exit subprocesses, do not keep multiple shells in parallel
2025-04-16 17:30:25 +02:00
2ea4afda4a
clean: move around some imports
2025-04-16 16:41:54 +02:00
18225f3356
fix(executing): return code on unknown cmd was unchanged, is now set to 127
2025-04-16 15:00:20 +02:00
81ba53237c
parsing: do not reset last_return_value at start of parsing
...
we need to preserve it, to be able to show the return value from the last command
2025-04-15 15:45:29 +02:00
81febcfcdd
debug: show command about to be executed in debug mode
2025-04-15 15:19:27 +02:00
ba9751e089
do postprocessing for each simple_cmd before execution
2025-04-15 15:13:17 +02:00
bb1390aac5
simple_cmd_execute: handle redirections
...
I am very uncertain on if this is actually correct, but I am unable to test it
very much atm
2025-04-15 15:11:50 +02:00
425722801b
refactor(do_waitpid): put into own file for easier acces from other modules
2025-04-15 15:11:26 +02:00
881c7f264c
signal: if a command is terminated by SIGQUIT, display that it core dumped
2025-04-15 15:11:11 +02:00
f1c132337b
exit: work for simple arguments
...
This does not address non-integer arguments, or extremly high/low arguments.
2025-04-15 15:03:13 +02:00
24ba87abba
exec: retain exit status of commands, including if they were signaled
2025-04-15 15:01:19 +02:00
5b7367925f
simple_cmd refactor: put subprocess functions in own file
...
This clears some space for new functions later
2025-04-15 14:41:44 +02:00
cea8043ec9
simple_cmd executing: show error in case execve fails
...
We don't have to check the return status, since execve only returns on failure.
Fixes #52
2025-04-15 14:41:43 +02:00
0a80b9fbe3
simple_cmd executing refactor: put builtin related utilities into own file
2025-04-01 16:38:41 +02:00
299e016a27
export: handle simple cases
2025-04-01 14:39:02 +02:00
e93e6efb93
builtins: cd: implement cd to absolute paths
2025-03-31 16:34:48 +02:00
5ce4a2b85f
builtin: implement pwd
2025-03-31 14:54:40 +02:00
66ea1328aa
simple_cmd executing: print error message on command not found
2025-03-28 16:58:13 +01:00
befe219436
simple_cmd executing: works with arguments and env
...
Does not handle redirections at all, no special facilities are in place to allow
nofork or builtin execution.
2025-03-28 14:50:37 +01:00