diff --git a/man/homectl.xml b/man/homectl.xml index 184bdcf6fd0..f2858166f7b 100644 --- a/man/homectl.xml +++ b/man/homectl.xml @@ -846,6 +846,10 @@ Exit status On success, 0 is returned, a non-zero failure code otherwise. + + When a command is invoked with with, the exit status of the child is + propagated. Effectively, homectl will exit without error if the command is + successfully invoked and finishes successfully. diff --git a/src/home/homectl.c b/src/home/homectl.c index cf1a2d9f9bb..a187a75d863 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -3362,4 +3362,4 @@ static int run(int argc, char *argv[]) { return dispatch_verb(argc, argv, verbs, NULL); } -DEFINE_MAIN_FUNCTION(run); +DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run); diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index 5390acabf30..570780030be 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -66,11 +66,15 @@ inspect test-user PASSWORD=xEhErW0ndafV4s homectl deactivate test-user inspect test-user -! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz +PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz +PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \ + && { echo 'unexpected success'; exit 1; } PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz -! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz +PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz +PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \ + && { echo 'unexpected success'; exit 1; } homectl remove test-user