1 After a massive refactoring, minish is quite buggy.
3 Using minish-once was too complicated.
4 Split a program into many parts
5 and have them depend on each other in complex ways is not modularity.
7 minish is now split in three programs:
8 minish, minish-read, and minish-eval.
9 minish starts minish-read and minish-eval in a loop:
10 the stdout of minish-read is connected to the stdin of minish-eval
12 minish-read is a filter:
13 when it reads a newline, it replaces it with ␀ and exits;
14 it outputs any other byte verbatim.
15 minish-eval reads from stdin,
16 constructs an argv for the command to be executed,
19 minish-read can communicate with minish using its return values,
20 because minish-read does not use execv().
21 If minish-read reaches a newline,
22 it exits with status 0 and minish carries on;
23 if there is an error while reading,
24 it exits with status 1 and minish returns EXIT_FAILURE;
25 it it reaches end of file,
26 it exits with status 2 and minish returns 0.
28 If it is in interactive mode,
29 minish puts minish-read and minish-eval in their own process group
30 and puts this group in the foreground.
31 minish-eval is the process group leader,
32 because it is expected to terminate after minish-read.
33 Ordering these actions has been tricky;
34 actually, I am not sure I have done it right.
35 More on this tomorrow.
40 https://stackoverflow.com/questions/3430315/