All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: Util-Linux <util-linux@vger.kernel.org>
Subject: [PATCH] Fix "Script started" buffering race
Date: Fri, 06 Feb 2015 19:59:14 +0100	[thread overview]
Message-ID: <54D50F02.4000709@suse.cz> (raw)

script -c "echo Hallo World" </dev/null >script.log ; cat script.log

Before:
Hallo World
Script started, file is typescript
Script started, file is typescript
Script done, file is typescript

After:
Script started, file is typescript
Hallo World
Script done, file is typescript
---
 term-utils/script.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/term-utils/script.c b/term-utils/script.c
index 548334c..02ba596 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -269,6 +269,7 @@ main(int argc, char **argv) {
 	sigprocmask(SIG_SETMASK, NULL, &block_mask);
 	sigaddset(&block_mask, SIGCHLD);
 
+	fflush(stdout);
 	sigprocmask(SIG_SETMASK, &block_mask, &unblock_mask);
 	child = fork();
 	sigprocmask(SIG_SETMASK, &unblock_mask, NULL);
-- 
2.2.2

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

             reply	other threads:[~2015-02-06 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 18:59 Stanislav Brabec [this message]
2015-02-10 10:28 ` [PATCH] Fix "Script started" buffering race Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D50F02.4000709@suse.cz \
    --to=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.