From d5b89d36224b394391af09fba7ed0a7921175610 Mon Sep 17 00:00:00 2001 From: Matthew Booth Date: Fri, 11 Sep 2009 17:04:13 +0100 Subject: 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. --- regressions/test-remote.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'regressions/test-remote.sh') 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 -- cgit