From 7783870db1f9b31f743c2392c4ecdeb1c39ca76c Mon Sep 17 00:00:00 2001 From: Micah Cowan Date: Sat, 12 Apr 2008 22:45:45 -0700 Subject: [PATCH] Don't create a logfile for --background if we're --quiet. --- src/ChangeLog | 10 ++++++++++ src/mswindows.c | 7 ++++++- src/utils.c | 10 +++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7201511a..27461263 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2008-04-12 Micah Cowan + + * mswindows.c (fake_fork_child): Don't create a logfile for + --background when --quiet is used, but not --server-response. + Don't mention that we're backgrounding if --quiet is used. Based + on a patch submitted by Rabin Vincent . Fixes bug + #20917. + + * utils.c (fork_to_background): Likewise. + 2008-04-11 Micah Cowan * ftp.c (getftp, ftp_loop_internal): Don't append to an existing diff --git a/src/mswindows.c b/src/mswindows.c index 40f0d762..5fe764e1 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -157,6 +157,10 @@ fake_fork_child (void) event = info->event; info->logfile_changed = false; + if (opt.quiet && !opt.server_response) + { + log_close (); + } if (!opt.lfilename) { /* See utils:fork_to_background for explanation. */ @@ -289,7 +293,8 @@ fake_fork (void) goto cleanup; } - printf (_("Continuing in background, pid %lu.\n"), pi.dwProcessId); + if (!opt.quiet) + printf (_("Continuing in background, pid %lu.\n"), pi.dwProcessId); if (info->logfile_changed) printf (_("Output will be written to `%s'.\n"), info->lfilename); diff --git a/src/utils.c b/src/utils.c index 3fd1435e..4d0560ee 100644 --- a/src/utils.c +++ b/src/utils.c @@ -301,6 +301,13 @@ fork_to_background (void) /* Whether we arrange our own version of opt.lfilename here. */ bool logfile_changed = false; + if (opt.quiet && !opt.server_response) + { + /* Don't bother with a logfile, there are virtually no logs we + issue in quiet mode. (Server responses in FTP are the + exception, when enabled.) */ + log_close (); + } if (!opt.lfilename) { /* We must create the file immediately to avoid either a race @@ -325,7 +332,8 @@ fork_to_background (void) else if (pid != 0) { /* parent, no error */ - printf (_("Continuing in background, pid %d.\n"), (int) pid); + if (!quiet) + printf (_("Continuing in background, pid %d.\n"), (int) pid); if (logfile_changed) printf (_("Output will be written to `%s'.\n"), opt.lfilename); exit (0); /* #### should we use _exit()? */ -- 2.39.2