This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).
The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.
Note that script(1) code does not provide fallback for systems/libc
where is no openpty().
Signed-off-by: Karel Zak <kzak@redhat.com>
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>