diff options
author | Matthew Booth <mbooth@redhat.com> | 2009-09-11 17:04:13 +0100 |
---|---|---|
committer | Matthew Booth <mbooth@redhat.com> | 2009-09-14 10:37:50 +0100 |
commit | d5b89d36224b394391af09fba7ed0a7921175610 (patch) | |
tree | 1609dbba7ad513ce79980fcd22c0096d8367e1ae /regressions | |
parent | 7eda9e6fb2b1f6504167ab650886f5a336fc6919 (diff) | |
download | libguestfs-d5b89d36224b394391af09fba7ed0a7921175610.tar.gz libguestfs-d5b89d36224b394391af09fba7ed0a7921175610.tar.xz libguestfs-d5b89d36224b394391af09fba7ed0a7921175610.zip |
guestfish: Redirect stdout when executing remote commands
guestfish --listen necessarily redirects its stdout to /dev/null so as not to
interfere with eval. The remote protocol doesn't contain any other provision for
collecting stdout for the caller, so executing guestfish --remote will never
generate any output.
This patch fixes that by forwarding the caller's STDOUT to the listener over the
unix socket connection. The listener redirects its STDOUT to the caller's STDOUT
for the duration of the command, then closes it again.
Diffstat (limited to 'regressions')
-rwxr-xr-x | regressions/test-remote.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/regressions/test-remote.sh b/regressions/test-remote.sh index f3c14b4b..783dd6e8 100755 --- a/regressions/test-remote.sh +++ b/regressions/test-remote.sh @@ -29,6 +29,18 @@ eval `../fish/guestfish --listen` ../fish/guestfish --remote sfdiskM /dev/sda , ../fish/guestfish --remote mkfs ext2 /dev/sda1 ../fish/guestfish --remote mount /dev/sda1 / + +# Failure of the above commands will cause the guestfish listener to exit. +# Incorrect return from echo_daemon will not, so need to ensure the listener +# exits in any case, while still reporting an error. +error=0 +echo=$(../fish/guestfish --remote echo_daemon "This is a test") +if [ "$echo" != "This is a test" ]; then + error=1; +fi + ../fish/guestfish --remote exit rm -f test.img + +exit $error |