public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dahl Nyerup <nyerup@one.com>
To: util-linux@vger.kernel.org
Cc: nyerup@one.com
Subject: [PATCH] script: Also flush writes to timing file.
Date: Mon, 17 Feb 2014 22:43:06 +0100	[thread overview]
Message-ID: <1392673386-42128-1-git-send-email-nyerup@one.com> (raw)

If both -f and -t are given, flush the timing fd on each write, similar
to the behavior on the script fd. This allows playback of still-running
sessions, and reduces the risk of ending up with empty timing files when
script(1) exits abnormally.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
---
 term-utils/script.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/term-utils/script.c b/term-utils/script.c
index a4c2e0c..49f21b6 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -442,6 +442,8 @@ dooutput(FILE *timingfd) {
 		}
 		if (fflg)
 			fflush(fscript);
+			if (tflg)
+				fflush(timingfd);
 		if (write_all(STDOUT_FILENO, obuf, cc)) {
 			warn (_("write failed"));
 			fail();
-- 
1.8.4


             reply	other threads:[~2014-02-17 21:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 21:43 Jesper Dahl Nyerup [this message]
2014-02-18 10:08 ` [PATCH] script: Also flush writes to timing file Sami Kerola
2014-02-18 10:21   ` Jesper Dahl Nyerup
2014-02-18 19:48 ` Jesper Dahl Nyerup
2014-02-18 19:51   ` Jesper Dahl Nyerup
2014-02-21 12:44   ` Karel Zak
2014-02-23 19:20     ` Jesper Dahl Nyerup

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=1392673386-42128-1-git-send-email-nyerup@one.com \
    --to=nyerup@one.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox