]> git.ipfire.org Git - thirdparty/util-linux.git/commit
script: add the -o/--output-limit option. Fix race test.
authorFred Mora <fmora@datto.com>
Mon, 14 May 2018 09:20:06 +0000 (11:20 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 14 May 2018 09:32:23 +0000 (11:32 +0200)
commitaefe9893385f05c40ae44a6b9e782cf96751e4dd
treeaaa54a4d055d97fc5d7b493552f8e6c4d68de364
parent4c9afd6e53f3cf632ee6234cc331200cc4becc67
script: add the -o/--output-limit option. Fix race test.

When script is used on a host with a relatively small free disk space, it
is sometimes desirable to limit the size of the captured output. This
can now be enforced with the --output-limit option.

The --output-limit option lets the user specify a maximum size. The program
uses the size parsing from strutils and thus supports the usual
multiplicative suffixes (kiB, KB, MiB, MB, etc.). After the specified
number of bytes have been written to the output file, the script program
will terminate the child process.

Due to buffering, the size of the output file might exceed the specified
limit. This limit also does not include the start and done messages.

The race test was throwing an error dur to a variable being "" in some cases.
Quoting the variable in the equal test took care of that test.

[kzak@redhat.com: - use done() to stop script
                  - count also timing file
                  - remove unnamed member initialization in ctl struct
                  - add to bash-completion]

Signed-off-by: Fred Mora <fmora@datto.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
bash-completion/script
term-utils/script.1
term-utils/script.c
tests/expected/script/options-size [new file with mode: 0644]
tests/ts/script/options
tests/ts/script/race