man/systemd-run: beef up info regarding interaction between --pty, --pipe, and --wait

This commit is contained in:
Mike Yuan 2024-05-21 21:39:02 +08:00
parent 2b4a691c32
commit d73a47d259
No known key found for this signature in database
GPG key ID: 417471C0A40F58B3

View file

@ -64,8 +64,8 @@
other service, and thus shows up in the output of <command>systemctl list-units</command> like any other unit. It
will run in a clean and detached execution environment, with the service manager as its parent process. In this
mode, <command>systemd-run</command> will start the service asynchronously in the background and return after the
command has begun execution (unless <option>--no-block</option> or <option>--wait</option> are specified, see
below).</para>
command has begun execution (unless <option>--no-block</option>, <option>--wait</option>, <option>--pipe</option>,
or <option>--pty</option> are specified, see below).</para>
<para>If a command is run as transient scope unit, it will be executed by <command>systemd-run</command>
itself as parent process and will thus inherit the execution environment of the caller. However, the
@ -325,6 +325,11 @@
to the terminal <command>systemd-run</command> is invoked on, via a pseudo TTY device. This allows running
programs that expect interactive user input/output as services, such as interactive command shells.</para>
<para>This option will result in <command>systemd-run</command> synchronously waiting for
the transient service to terminate, similar to specifying <option>--wait</option>. If specified
along with <option>--wait</option>, <command>systemd-run</command> won't exit when manually disconnecting
from the pseudo TTY device.</para>
<para>Note that
<citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
<command>shell</command> command is usually a better alternative for requesting a new, interactive login
@ -341,15 +346,19 @@
<listitem><para>If specified, standard input, output, and error of the transient service are inherited from the
<command>systemd-run</command> command itself. This allows <command>systemd-run</command>
to be used within shell pipelines.
Note that this mode is not suitable for interactive command shells and similar, as the
service process will not become a TTY controller when invoked on a terminal. Use <option>--pty</option> instead
in that case.</para>
to be used within shell pipelines.</para>
<para>Note that this mode is not suitable for interactive command shells and similar, as the
service process will not become a TTY controller when invoked on a terminal. Use <option>--pty</option>
instead in that case.</para>
<para>When both <option>--pipe</option> and <option>--pty</option> are used in combination the more appropriate
option is automatically determined and used. Specifically, when invoked with standard input, output and error
connected to a TTY <option>--pty</option> is used, and otherwise <option>--pipe</option>.</para>
<para>This option will result in <command>systemd-run</command> synchronously waiting for
the transient service to terminate, similar to specifying <option>--wait</option>.</para>
<para>When this option is used the original file descriptors <command>systemd-run</command> receives are passed
to the service processes as-is. If the service runs with different privileges than
<command>systemd-run</command>, this means the service might not be able to reopen the passed file