Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2024 11:00:17 -0700
From:      Yuri <yuri@FreeBSD.org>
To:        Freebsd hackers list <freebsd-hackers@FreeBSD.org>
Subject:   Can stdout/stderr of a running process be dynamically redirected in FreeBSD ?
Message-ID:  <1e288f98-564a-488d-a98d-b7f45afac2c1@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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


[-- Attachment #2 --]
<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="monospace">Imagine the situation when there is a
        process that is running in the terminal and periodically
        printing something related to its progress.</font></p>
    <p><font face="monospace">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.<br>
      </font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace">There is the project for Linux called
        "redirect" that does such stdout/stderr redirection:
        <a class="moz-txt-link-freetext" href="https://github.com/jerome-pouiller/reredirect/">https://github.com/jerome-pouiller/reredirect/</a></font></p>;
    <p><font face="monospace">However, it uses ptrace functions that are
        missing in FreeBSD, like <span
          style="color:#000000;background-color:#ffffff;">PTRACE_POKEUSER</span>.</font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace">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?</font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace">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.<br>
      </font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace">Thanks,</font></p>
    <p><font face="monospace">Yuri</font></p>
    <p><font face="monospace"><br>
      </font></p>
  </body>
</html>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1e288f98-564a-488d-a98d-b7f45afac2c1>