From f0ccb77460d4bd41b45de7d2ddb54294b91e9e3b Mon Sep 17 00:00:00 2001
From: ja <address@hidden(none)>
Date: Sun, 18 Sep 2016 18:47:37 +0200
Subject: [PATCH] Don't print to stdout in background.
[31;01m---[39;49;00m
src/main.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
[01mdiff --git a/src/main.c b/src/main.c[39;49;00m
[01mindex ac6ee2c..f324253 100644[39;49;00m
[31;01m--- a/src/main.c[39;49;00m
[32m+++ b/src/main.c[39;49;00m
[01m[35m@@ -113,7 +113,7 @@ int numurls = 0;[39;49;00m
setting up gettext's message catalog using bindtextdomain and
textdomain. Does nothing if NLS is disabled or missing. */
[31;01m-#if defined(SIGHUP) || defined(SIGUSR1)[39;49;00m
[32m+#if defined(SIGHUP) || defined(SIGUSR1) || defined(SIGCONT)[39;49;00m
/* Hangup signal handler. When wget receives SIGHUP or SIGUSR1, it
will proceed operation as usual, trying to write into a log file.
If that is impossible, the output will be turned off. */
[01m[35m@@ -131,12 +131,20 @@ redirect_output_signal (int sig)[39;49;00m
if (sig == SIGUSR1)
signal_name = "SIGUSR1";
#endif
[32m+#ifdef SIGCONT[39;49;00m
[32m+ if(sig == SIGCONT) {[39;49;00m
[32m+ /* If process goes to foreground, don't redirect output */[39;49;00m
[32m+ if(getpgrp() == tcgetpgrp(STDOUT_FILENO))[39;49;00m
[32m+ return;[39;49;00m
[32m+ signal_name = "SIGCONT";[39;49;00m
[32m+ }[39;49;00m
[32m+#endif[39;49;00m
log_request_redirect_output (signal_name);
progress_schedule_redirect ();
signal (sig, redirect_output_signal);
}
[31;01m-#endif /* defined(SIGHUP) || defined(SIGUSR1) */[39;49;00m
[32m+#endif /* defined(SIGHUP) || defined(SIGUSR1) ||
defined(SIGCONT)*/[39;49;00m
static void
i18n_initialize (void)
[01m[35m@@ -2003,6 +2011,9 @@ only if outputting to a regular
file.\n"));[39;49;00m
#ifdef SIGUSR1
signal (SIGUSR1, redirect_output_signal);
#endif
[32m+#ifdef SIGCONT[39;49;00m
[32m+ signal (SIGCONT, redirect_output_signal);[39;49;00m
[32m+#endif[39;49;00m
#ifdef SIGPIPE
/* Writing to a closed socket normally signals SIGPIPE, and the
process exits. What we want is to ignore SIGPIPE and just check
[31;01m-- [39;49;00m
1.7.9.5