Avoid installing signal handlers that are io-logger specific. Fixes
job control when no io logger is enabled.
This commit is contained in:
10
src/script.c
10
src/script.c
@@ -369,7 +369,6 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
|
|||||||
|
|
||||||
/* If stdout is not a tty we handle post-processing differently. */
|
/* If stdout is not a tty we handle post-processing differently. */
|
||||||
ttyout = isatty(STDOUT_FILENO);
|
ttyout = isatty(STDOUT_FILENO);
|
||||||
}
|
|
||||||
|
|
||||||
/* Signals to relay from parent to child. */
|
/* Signals to relay from parent to child. */
|
||||||
sa.sa_flags = 0; /* do not restart syscalls for these */
|
sa.sa_flags = 0; /* do not restart syscalls for these */
|
||||||
@@ -384,7 +383,7 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
|
|||||||
sigaction(SIGTTOU, &sa, NULL);
|
sigaction(SIGTTOU, &sa, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (log_io && foreground) {
|
if (foreground) {
|
||||||
/* Copy terminal attrs from user tty -> pty slave. */
|
/* Copy terminal attrs from user tty -> pty slave. */
|
||||||
if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE], ttyout)) {
|
if (term_copy(script_fds[SFD_USERTTY], script_fds[SFD_SLAVE], ttyout)) {
|
||||||
tty_initialized = 1;
|
tty_initialized = 1;
|
||||||
@@ -400,6 +399,7 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
|
|||||||
if (!n)
|
if (!n)
|
||||||
error(1, "Can't set terminal to raw mode");
|
error(1, "Can't set terminal to raw mode");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Set command timeout if specified. */
|
/* Set command timeout if specified. */
|
||||||
if (ISSET(details->flags, CD_SET_TIMEOUT))
|
if (ISSET(details->flags, CD_SET_TIMEOUT))
|
||||||
@@ -956,13 +956,13 @@ sigchild(int s)
|
|||||||
|
|
||||||
if (!tq_empty(&io_plugins))
|
if (!tq_empty(&io_plugins))
|
||||||
flags |= WUNTRACED;
|
flags |= WUNTRACED;
|
||||||
else
|
|
||||||
recvsig = SIGCHLD;
|
|
||||||
do {
|
do {
|
||||||
pid = waitpid(child, &child_status, flags);
|
pid = waitpid(child, &child_status, flags);
|
||||||
} while (pid == -1 && errno == EINTR);
|
} while (pid == -1 && errno == EINTR);
|
||||||
if (pid == child) {
|
if (pid == child) {
|
||||||
if (WIFSTOPPED(child_status))
|
if (tq_empty(&io_plugins))
|
||||||
|
recvsig = SIGCHLD;
|
||||||
|
else if (WIFSTOPPED(child_status))
|
||||||
recvsig = WSTOPSIG(child_status);
|
recvsig = WSTOPSIG(child_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user