Discussion:
Can stdout/stderr of a running process be dynamically redirected in FreeBSD ?
(too old to reply)
Yuri
2024-06-09 18:00:17 UTC
Permalink
Imagine the situation when there is a process that is running in the
terminal and periodically printing something related to its progress.

At some point this terminal output should be replaced by a TUI in the
same terminal that would capture the original process' output and show
it in its TUI sub-window, and would also show some other info.


There is the project for Linux called "redirect" that does such
stdout/stderr redirection: https://github.com/jerome-pouiller/reredirect/

However, it uses ptrace functions that are missing in FreeBSD, like
PTRACE_POKEUSER.


Is it possible to perform the action like is described in the first
paragraph in some other way, given that ptrace doesn't have required
functions?


This function is useful in many business contexts, when users run some
long-running tools, and there is a variety of ways how results of these
tools can be displayed to the user.



Thanks,

Yuri
Warner Losh
2024-06-09 18:35:25 UTC
Permalink
Post by Yuri
Imagine the situation when there is a process that is running in the
terminal and periodically printing something related to its progress.
At some point this terminal output should be replaced by a TUI in the same
terminal that would capture the original process' output and show it in its
TUI sub-window, and would also show some other info.
There is the project for Linux called "redirect" that does such
stdout/stderr redirection: https://github.com/jerome-pouiller/reredirect/
However, it uses ptrace functions that are missing in FreeBSD, like
PTRACE_POKEUSER.
Is it possible to perform the action like is described in the first
paragraph in some other way, given that ptrace doesn't have required
functions?
This function is useful in many business contexts, when users run some
long-running tools, and there is a variety of ways how results of these
tools can be displayed to the user.
Look at the snp device and watch. They are close if a tty is involved.

Warner
Post by Yuri
Thanks,
Yuri
Loading...