IIGS_User wrote:I think it's because DOSBox is a sub thread of the Terminal application then, so if you quit the Terminal, DOSBox will be exited by default.
Nah - can't be. MacOSX/Unix has no concept of "sub threads". The dosbox process will be a child from the terminal process, but it is in no way dependent on its father process. It will inherit everything from its parent - working directory, environment variables, open files, etc, etc.
What actually happens is that when the terminal process (or rather, the Bash command line interpreter that you enter the "dosbox" command into) clones itself, then quickly goes about closing open files (with the exception of stdin, stdout, and stderr), and then reads in the EXE-code for dosbox and transfers control to the new code - and then dosbox is running.
While all this cloning is going on, the terminal (Bash) sits around and waits for its clone-child to finish. Adding the magic '&' after the command tells Bash no to wait, but carry on, prompting you for the next command.
The child inherited everything from its parent, including how to react to certain events (signals), e.g. when you hit CTRL-C (which generates an INT-errupt signal). In the good old days, another event that could happen, was that your modem connection to the big, hulking box of iron that Unix was running on was dropped - known as a modem Hang Up (HUP). I am not sure, but I expect that closing down the terminal window would send a HUP signal to all child processes, including dosbox, and by default that HUP-signal would cause the child (dosbox) to terminate.
Prefixing the dosbox command with 'nohup' twists the handling of the HUP-signal so it is ignored by dosbox (again, a lot of cloning going on here - Bash clones itself, loads the EXE-code for nohup, the nohup code disables HUP-handling, and replaces its own EXE-code with that of DOSBox, which is now immune to HUP signals).
The convoluted >, >&, and < /dev/null stuff is desperate attempt to redirect stdin, stderr and stdin to something else before dosbox is launched - just in case that their disappearance (when the terminal window is closed) somehow causes a problem.
Alas - none of all that worked it seemed 🙁
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32