Skip to content

Conversation

@nmeum
Copy link
Contributor

@nmeum nmeum commented Mar 18, 2025

OpenRC already supports redirecting standard output/error of services. This patch adds support for redirecting standard input as well. I encountered the lack of this feature while working on a user service for a Wayland compositor status bar which reads status text to be displayed from stdin. Input redirection allows me to connect this user services with another user service providing the status text via a named pipe.

Note that input redirection is also supported by systemd (and potentially other service supervisors) through the StandardInput= directive [1]. I intentionally did not implement redirection from a program as an input as I believe that in such a case the input program (assuming it is long-running) should be supervised by OpenRC as well and the two should be connected through a named pipe.

OpenRC already supports redirecting standard output/error of services.
This patch adds support for redirecting standard input as well. I
encountered the lack of this feature while working on a user service for
a Wayland compositor status bar which reads status text to be displayed
from stdin. Input redirection allows me to connect this user services to
another user service providing the status text via a named pipe.

Note that input redirection is also supported by SystemD (and
potentially other service supervisors) through the `StandardInput=`
directive [1].

[1]: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardInput=
@navi-desu
Copy link
Member

I intentionally did not implement redirection from a program as an input as I believe that in such a case the input program (assuming it is long-running) should be supervised by OpenRC as well and the two should be connected through a named pipe.

the same could be argued for {output,error}_logger tbh, which fwiw i want to default to posix logger in #783 -- this now gives me thoughts about if we want to supervise the logger too

Copy link
Contributor

@N-R-K N-R-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise looks okay. Some small documentation rewording suggestions:

@nmeum
Copy link
Contributor Author

nmeum commented Mar 19, 2025

Revised the documentation a bit to make it more concise. Anything else? :)

@navi-desu navi-desu merged commit 9aceaee into OpenRC:master Mar 24, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants