diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-05-02 13:55:18 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-05-02 13:55:18 +0100 |
commit | 1304236c6c666ac0ef2174299f0a0270f3dec347 (patch) | |
tree | cf85cd448e8ad45345e49c7e03058a28d29ac49a /fish/guestfish.pod | |
parent | 95a67b1e6ad315af0ea7bedbb5348512635e4834 (diff) | |
download | libguestfs-1304236c6c666ac0ef2174299f0a0270f3dec347.tar.gz libguestfs-1304236c6c666ac0ef2174299f0a0270f3dec347.tar.xz libguestfs-1304236c6c666ac0ef2174299f0a0270f3dec347.zip |
fish: Add --pipe-error flag to allow detection of errors in pipe commands (RHBZ#803533).
For a test case, see:
https://bugzilla.redhat.com/show_bug.cgi?id=803533
In guestfish, we use the gnulib closeout module which sets up an
atexit handler to detect if there were any errors on stdout when the
program exits. This is so we can fail correctly in out of disk space
cases like:
guestfish [...] > output
However the atexit handler just checks that there was any error on
stdout (using ferror). If a pipe command such as:
><fs> command_with_lots_of_output | head
ran at any time during the session, the error flag would be set
(because the underlying writes failed with EPIPE errors).
So the commit first adds a test for ferror (stdout) after each command
that we issue. This brings error handling closer to the point of
failure, and so is generally a good thing.
Secondly we reset the error flag after detecting and dealing with the
error, so that avoids the redundant 'guestfish: write error' message
produced by gnulib closeout.
Thirdly we add a --pipe-error flag which causes guestfish commands to
fail on pipe commands line the one above. The default is off for
backwards compatibility reasons.
Diffstat (limited to 'fish/guestfish.pod')
-rw-r--r-- | fish/guestfish.pod | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fish/guestfish.pod b/fish/guestfish.pod index a45af00d..29aa2d6e 100644 --- a/fish/guestfish.pod +++ b/fish/guestfish.pod @@ -350,6 +350,18 @@ alternative to the I<-a> option: whereas I<-a> adds an existing disk, I<-N> creates a preformatted disk with a filesystem and adds it. See L</PREPARED DISK IMAGES> below. +=item B<--pipe-error> + +If writes fail to pipe commands (see L</PIPES> below), then the +command returns an error. + +The default (also for historical reasons) is to ignore such errors so +that: + + ><fs> command_with_lots_of_output | head + +doesn't give an error. + =item B<--progress-bars> Enable progress bars, even when guestfish is used non-interactively. |