Add alias to -t,--timing to make it easy to copy and past script(1)
comnand line to scriptlive(1) and scriptreplay(1) command lines.
For example:
record:
$ script --log-timing tm --log-in in
print:
$ scriptreplay --log-timing tm --log-in in
re-run:
$ scriptlive --log-timing tm --log-in in
And command line is still the same.
Signed-off-by: Karel Zak <kzak@redhat.com>
After this change shell executed by scriptlive(1) is going to behave
like shell in script(1). It means that the shell stdin is a
pseudo-terminal rather than pipe. This allows live replay of
interactive applications, ssh sessions, etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
This allows to control mainloop behavior from PTY applications. For
example you can write to child (shell) process independently on the
current stdin.
Signed-off-by: Karel Zak <kzak@redhat.com>
* use timeval rather than double for delay
* use sys/time.h macros for wirk with timeval
* add delay normalization to script-playutils.c API
Signed-off-by: Karel Zak <kzak@redhat.com>
The new header/info lines in log uses 0, but it's unexpected by
scriptreplay as there was always number formatted by %f.
Signed-off-by: Karel Zak <kzak@redhat.com>
The idea is to consolidate script(1), scriptlive(1) and su(1) --pty
and use the same code everywhere.
TODO: add callbacks for stdin/out logging (necessary for script(1)).
Signed-off-by: Karel Zak <kzak@redhat.com>
The old good scriptreplay(1) just display your recorded session, the
scriptlive(1) uses stdin typescript (from new script(1)) to execute
your commands again.
Signed-off-by: Karel Zak <kzak@redhat.com>
The stdin log does not contain line breaks as command line uses CR
between commands. This makes scriptreplay for stdin very
user-unfriendly, because it overwrites still the same line.
The new option --cr-mode provides opportunity to control this
behavior. The default for stdin logs is replace CR with line-break.
Signed-off-by: Karel Zak <kzak@redhat.com>
* add internal support for multiple log files
* add support for new timing file format (default is old format)
Signed-off-by: Karel Zak <kzak@redhat.com>
* allow to use --log-in <infile> and --log-out <outfile> in the same time
* add --log-io <file> to log stdout and stdin to the one log file
* introduce a new timing file format with entry type identifirs
I <delay> <size> : info about input stream
O <delay> <size> : info about output stream
in the next commits it's possible to add 'S' for signals and 'H' for
extra (header) information.
* the new file format is optional and enabled only if multiple streams
logging is requested.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's allow to log input independently on output. So it's possible to
script --log-in infile : logs only input
script --log-out outfile : logs only output
script --log-out outfile --log-in infile : logs both to separated files
Signed-off-by: Karel Zak <kzak@redhat.com>
The current -t[=<file>] is pretty messy due to optional <file>
argument; and default is to output to stderr. The default output to
stderr is very unusual semantic. This path makes the old -t
deprecated.
The new option -T, --log-timing requires the file name.
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit does not add any new feature. It just prepare code for
future extensions only.
* introduce two new structs: script_stream and script_log
* define two streams: 'stdout' and 'stdin'
* allow associate log files (type script or timing file) with the stream
* support more log file formats
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's be more verbose and provide real open() error to make
debugging easier on --verbose.
For example:
$ hwclock --verbose
hwclock from util-linux 2.34.193-6bebea-dirty
System Time: 1570445823.701266
Trying to open: /dev/rtc0
hwclock: cannot open /dev/rtc0: Permission denied <---
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.
Addresses: https://github.com/karelzak/util-linux/issues/879
Signed-off-by: Karel Zak <kzak@redhat.com>