summaryrefslogtreecommitdiffstats
path: root/term-utils/script.c
diff options
context:
space:
mode:
authorSami Kerola2014-12-26 18:57:46 +0100
committerSami Kerola2015-06-08 22:52:51 +0200
commit076ffa48f3875867749fe5c23973aaa52ee843a9 (patch)
treefdcc91231bfb8ab44077b9a481b1f0f335732dd1 /term-utils/script.c
parentscript: remove io vs signal race (diff)
downloadkernel-qcow2-util-linux-076ffa48f3875867749fe5c23973aaa52ee843a9.tar.gz
kernel-qcow2-util-linux-076ffa48f3875867749fe5c23973aaa52ee843a9.tar.xz
kernel-qcow2-util-linux-076ffa48f3875867749fe5c23973aaa52ee843a9.zip
script: add 'Script started' line always to capture file
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>
Diffstat (limited to 'term-utils/script.c')
-rw-r--r--term-utils/script.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/term-utils/script.c b/term-utils/script.c
index 391aa9e5e..27c1bdb72 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -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 */