X Tutup
Skip to content

Commit b9bfa25

Browse files
committed
homectl,TEST-46: fix test and fix homectl return value, update docs
The usual: the test wasn't testing, so we didn't notice that the command wasn't returning as expected.
1 parent f49467b commit b9bfa25

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

man/homectl.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@
846846
<title>Exit status</title>
847847

848848
<para>On success, 0 is returned, a non-zero failure code otherwise.</para>
849+
850+
<para>When a command is invoked with <command>with</command>, the exit status of the child is
851+
propagated. Effectively, <command>homectl</command> will exit without error if the command is
852+
successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
849853
</refsect1>
850854

851855
<xi:include href="common-variables.xml" />

src/home/homectl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3362,4 +3362,4 @@ static int run(int argc, char *argv[]) {
33623362
return dispatch_verb(argc, argv, verbs, NULL);
33633363
}
33643364

3365-
DEFINE_MAIN_FUNCTION(run);
3365+
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);

test/units/testsuite-46.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,15 @@ inspect test-user
6666
PASSWORD=xEhErW0ndafV4s homectl deactivate test-user
6767
inspect test-user
6868

69-
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
69+
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
70+
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
71+
&& { echo 'unexpected success'; exit 1; }
7072
PASSWORD=xEhErW0ndafV4s homectl with test-user -- touch /home/test-user/xyz
7173
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
7274
PASSWORD=xEhErW0ndafV4s homectl with test-user -- rm /home/test-user/xyz
73-
! PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz
75+
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test ! -f /home/test-user/xyz
76+
PASSWORD=xEhErW0ndafV4s homectl with test-user -- test -f /home/test-user/xyz \
77+
&& { echo 'unexpected success'; exit 1; }
7478

7579
homectl remove test-user
7680

0 commit comments

Comments
 (0)
X Tutup