]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: add 'Script started' line always to capture file
authorSami Kerola <kerolasa@iki.fi>
Fri, 26 Dec 2014 17:57:46 +0000 (17:57 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 8 Jun 2015 20:52:51 +0000 (21:52 +0100)
The scriptreplay(1) will expect capture file always to have header.
Before this change the --quiet option together with timing caused
following replay error.

$ script --quiet --timing=timing
[...]
$ scriptreplay timing typescript
[...]
scriptreplay: unexpected end of file on typescript

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils/script.c

index 391aa9e5ec2f434fa97d3bfacf2ed5db3b140060..27c1bdb728db76edd6dbb4f578f0d8fc90b53f58 100644 (file)
@@ -247,6 +247,7 @@ static void do_io(struct script_control *ctl)
        int ret, i;
        ssize_t bytes;
        double oldtime = time(NULL);
+       time_t tvec = script_time((time_t *)NULL);
 
        if (ctl->tflg && !ctl->timingfp)
                ctl->timingfp = fdopen(STDERR_FILENO, "w");
@@ -258,11 +259,8 @@ static void do_io(struct script_control *ctl)
        pfd[2].fd = ctl->sigfd;
        pfd[2].events = POLLIN | POLLERR | POLLHUP;
 
-       if (!ctl->qflg) {
-               time_t tvec = script_time((time_t *)NULL);
-               my_strftime(buf, sizeof buf, "%c\n", localtime(&tvec));
-               fprintf(ctl->typescriptfp, _("Script started on %s"), buf);
-       }
+       my_strftime(buf, sizeof buf, "%c\n", localtime(&tvec));
+       fprintf(ctl->typescriptfp, _("Script started on %s"), buf);
 
        while (!ctl->die) {
                /* wait for input or signal */