run: reject waiting for remain-after-exit services
Reproducer:
unit=run-wait-rae-$(date +%s)
sudo timeout 3s systemd-run --wait --remain-after-exit \
--unit="$unit" /bin/true
echo $?
systemctl is-active "$unit.service"
Before, the command timed out with exit status 124 while the service
stayed active. --wait waits for deactivation, but RemainAfterExit=yes
keeps the service active after the command exits.
Follow-up for 2a453c2ee3
This commit is contained in:
@@ -717,6 +717,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
if (arg_no_block)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"--pty/--pty-late/--pipe is not compatible with --no-block.");
|
||||
|
||||
if (arg_remain_after_exit)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"--pty/--pty-late/--pipe is not compatible with --remain-after-exit.");
|
||||
}
|
||||
|
||||
if (arg_stdio == ARG_STDIO_PTY && arg_pty_late && streq_ptr(arg_service_type, "oneshot"))
|
||||
@@ -761,6 +765,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
if (arg_scope)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"--wait may not be combined with --scope.");
|
||||
|
||||
if (arg_remain_after_exit)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"--wait may not be combined with --remain-after-exit.");
|
||||
}
|
||||
|
||||
if (arg_scope && arg_root_directory)
|
||||
|
||||
Reference in New Issue
Block a user