-
Don Lipari authored
Gerrit Renker: I found an easier test: after making sure that stdin is not redirected, check whether there is a non-negative terminal process group (it is -1 if there is no controlling terminal). Also, I think that the heuristic "only interactive if from login shell" is needlessly complicated/obscure. Most (if not all) shells that support job control place processes in their own process group (pid == pgrp): it now uses this as indicator of interactive mode. The following tests now pass: salloc & # from login shell and from nested shell salloc --no-shell& # ok salloc /bin/date& # wants to be placed into the foreground salloc /bin/date </dev/null & # ok setsid salloc # complains there is no controlling terminal setsid salloc --no-shell& # ok
Don Lipari authoredGerrit Renker: I found an easier test: after making sure that stdin is not redirected, check whether there is a non-negative terminal process group (it is -1 if there is no controlling terminal). Also, I think that the heuristic "only interactive if from login shell" is needlessly complicated/obscure. Most (if not all) shells that support job control place processes in their own process group (pid == pgrp): it now uses this as indicator of interactive mode. The following tests now pass: salloc & # from login shell and from nested shell salloc --no-shell& # ok salloc /bin/date& # wants to be placed into the foreground salloc /bin/date </dev/null & # ok setsid salloc # complains there is no controlling terminal setsid salloc --no-shell& # ok
NEWS 322.90 KiB