summaryrefslogtreecommitdiffstats
path: root/src/shared/ptyfwd.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* run: add environment variable to prevent the setting of terminal titleMantas MikulÄ—nas2024-06-251-0/+2
| | | | | | This goes together with the existing SYSTEMD_TINT_BACKGROUND. Closes https://github.com/systemd/systemd/issues/33301
* ptyfwd: optionally prefix window title with colored dotLennart Poettering2024-02-231-0/+3
| | | | | | | | | | | | | | in uid0/systemd-run/nspawn we already set a window title with a colorful unicode dot indicating the changed privileges/execution context. This typically gets overriden by the shell inside the environment however. Let's tweak this a bit: when we see the window title OSC ANSI sequence passing through, let's patch in the unicode dot as a prefix to the title. This is super pretty, since it makes sure root sessions via 0ad are really easily recognizable as such, because the window title carries an 🔴 red dot as prefix then.
* ptyfwd: automatically turn off tinting/window title logic on dumb terminalsLennart Poettering2024-02-091-3/+7
| | | | | If we are not talking to a reasonable terminal let's not try to set the window title or tint the background.
* ptyfwd: optionally update window title if we are running a ptyfwd sessionLennart Poettering2024-02-091-0/+2
|
* ptyfwd: optionally, change ANSI background color of forwarded terminalsLennart Poettering2023-12-211-0/+2
| | | | | | | | | | | | | | | | | | | As the bytes flow through our terminal forwarder we can color the background of the terminal with a color of our choices, if that's desired. This will later allow us to color the background of the uid0 tool when running as root with a slightly alarming red color. This does two things: 1. When an ANSI sequence is seen that resets the background color, it is extended to immediately set the color to our choice. 2. When a newline is seen it is immeidately extended to set the background color again and clear the current line till the end. Net effect: all lines written while we forward the ttys will be shown with the background color of choice.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: add whitespace between type and variable nameYu Watanabe2018-12-041-1/+1
|
* ptyfwd: optionally override terminal width/heightLennart Poettering2018-11-291-0/+2
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* run: run pty forwarder at higher event priority than the busLennart Poettering2017-12-051-0/+2
| | | | | We want any tty I/O to happen before we look at service messages, hence let's set priorities on them, and give tty I/O a higher priority.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* run: exit early in --pty if service failedLennart Poettering2017-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | This reworks systemd-run so that in --pty mode we watch the unit state the way we do it in --wait mode. Whenever we notice that the service is in failed or inactive state finish right-away, but first write all unwritten characters we can read from the master TTY device. This makes sure that when the TTY service fails before it opens the slave PTY device we properly notice that and exit early, so that borked start parameters result in immediate systemd-run failure. Previously, we'd not notice this at all, as a PTY slave that never was opened won't result in POLLHUP events, and we'd hence simply keep reading from it forever. In essence, --pty now enables the same unit watching logic that --wait enables. However, unless --wait is specified we won#t show the final summary, hence the effective difference should be pretty minimal. Fixes: #3915
* run: optionally, wait for the service to finish and show its resultLennart Poettering2016-08-221-1/+7
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* shared: include what we useThomas Hindoe Paaboel Andersen2015-12-061-0/+2
| | | | | The next step of a general cleanup of our includes. This one mostly adds missing includes but there are a few removals as well.
* machinectl: fix race when opening new shells with "machinectl shell"Lennart Poettering2015-10-071-1/+11
| | | | | | | | | | | | | | | | | Previously, we'd allocate the TTY, spawn a service on it, but immediately start processing the TTY and forwarding it to whatever the commnd was started on. This is however problematic, as the TTY might get actually opened only much later by the service. We'll hence first get EIOs on the master as the other side is still closed, and hence considered it hung up and terminated the session. With this change we add a flag to the pty forwarding logic: PTY_FORWARD_IGNORE_INITIAL_VHANGUP. If set, we'll ignore all hangups (i.e. EIOs) on the master PTY until the first byte is successfully read. From that point on we consider a hangup/EIO a regular connection termination. This way, we handle the race: when we get EIO initially we'll ignore it, until the connection is properly set up, at which time we start honouring it.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-3/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* nspawn: when connected to pipes for stdin/stdout, pass them as-is to PID 1Lennart Poettering2015-02-181-1/+1
| | | | | | | | | | | Previously we always invoked the container PID 1 on /dev/console of the container. With this change we do so only if nspawn was invoked interactively (i.e. its stdin/stdout was connected to a TTY). In all other cases we directly pass through the fds unmodified. This has the benefit that nspawn can be added into shell pipelines. https://bugs.freedesktop.org/show_bug.cgi?id=87732
* Add missing includes in header filesThomas Hindoe Paaboel Andersen2015-02-121-0/+2
| | | | | This fixes various issues found by globally reordering the include sections of all .c files.
* ptyfwd: simplify how we handle vhangups a bitLennart Poettering2015-01-071-3/+3
|
* machinectl: make sure that "machinectl login" exits immediately when the ↵Lennart Poettering2015-01-071-1/+4
| | | | machine it is connected to dies
* run: add a new "-t" mode for invoking a binary on an allocated TTYLennart Poettering2014-12-231-1/+3
|
* ptyforward: rework PTY forwarder logic used by nspawn to utilize the normal ↵Lennart Poettering2014-10-311-1/+8
| | | | | | | event loop We really should not run manual event loops anymore, but standardize on sd_event, so that we can run sd_bus connections from it eventually.
* nspawn: split out pty forwaring logic into ptyfwd.cLennart Poettering2013-10-311-0/+27