diff --git a/systemd/systemd-lib.pl b/systemd/systemd-lib.pl index fd9b3db2d..8cbe8a777 100644 --- a/systemd/systemd-lib.pl +++ b/systemd/systemd-lib.pl @@ -585,10 +585,11 @@ my ($name) = @_; return (0, $text{'systemd_ename'}) if (!valid_unit_name($name)); my $out = backquote_logged( "systemctl start ".quotemeta($name)." 2>&1 /dev/null"); } -return (!$?, $out); +return (!$rv, $out); } =head2 stop_unit(name) diff --git a/systemd/t/run-tests.t b/systemd/t/run-tests.t index 58a24136b..8dcae4e32 100644 --- a/systemd/t/run-tests.t +++ b/systemd/t/run-tests.t @@ -846,6 +846,15 @@ like(get_unit_root(), qr{^/(etc|usr/lib|lib)/systemd/system$}, 'dependency command uses full non-paged output'); } +# Failed starts must remain failures even when journal diagnostics succeed. +{ + local *main::backquote_logged = sub { $? = 256; return 'See journalctl for details'; }; + local *main::backquote_command = sub { $? = 0; return 'Start failed'; }; + my ($ok, $out) = start_unit('broken.service'); + ok(!$ok, 'journal lookup cannot hide a failed start'); + like($out, qr/Start failed/, 'failed start includes diagnostics'); +} + { my @cmds; my $reloaded = 0;