Ask Reuben
GDC Start Command in a New Shell
When should you check the “Start Command in a New Shell” GDC option?
Why do you always check the “Start Command in a New Shell” GDC option?
Why when I exit my menu program do my child programs stop?
Sometimes when you get to my age, there are things you do that you do without thinking, and the question is why do you do it that way? The decision was made many years ago and you carry that on without thinking why. That happened recently with the GDC – Start Command in a New Shell checkbox. I always check it but why do I always check it?
First of all, what is the GDC – Start Command in a New Shell checkbox? When creating a GDC Short-cut using Direct Connection, on screen 3 of the wizard …
… there you will see “Start command in a new shell”, this is the option I habitually check.
The documentation describes it as “allows you to start a regular shell session before executing the remote host command”. Also note in the documentation how it says you must exit the command discussed in a previous step. So my command might be the following if starting the demo program shipped in FGLDIR/demo (where X.YY.ZZ is my version)…
@FGL; cd /opt/fourjs/fgl/5.01.00; . ./envcomp; cd demo; fglrun demo; exit
… note the exit at the end to explicitly exit the new shell.
So why do I check GDC -Start Command in a New Shell?, and then have to make sure my shell exits.
The answer I think is because the program I am launching is most likely a Main Menu program where the user selects what program they want to run. These child programs are then launched via RUN WITHOUT WAITING or perhaps via a StartMenu . When the Main Menu exits, you want these child programs to continue running.
If I did not use Start Command in a New Shell then when the user exits this Main Menu program, these child programs will end as well.. By starting in a New Shell, these child programs remain connected to the GDC and running when the user exits the Main Menu program.
If you want to experiment, create a Direct Connection shortcut to $FGLDIR/demo/demo.42r without this option checked. Launch any program from the demo program and exit the demo menu program, note how your child program disappears. Now edit the shortcut and check the Start Command in a New Shell option (and remember to add exit to the command), again launch any child program and exit the demo menu program and note how the child program remains.
As most applications I work on have an equivalent of what I call a Main Menu program, that is they have a RUN WITHOUT WAITING or equivalent, then checking the Start Command in a New Shell is the right thing to do.