0

There are three processes:

  • A "control program", call it CP.
  • CP launches a manager process, call it MP.
  • MP launches a worker process, call it WP.

CP is the only program I can modify. All interaction with MP and WP is via stdin and stdout, and by operating system operations given the PID of MP and WP.

WP runs for a while and then signals that it is ready for the next stage.

I want CP take control of WP, detaching it from MP. CP will gain direct access to the stdin, stdout, stderr of WP. MP will then terminate, and WP will continue running under CP's control.

How can I do this on Linux, in Python?

1 Answer 1

0

You can open the file descriptors or WP from /proc, e.g. /proc/123/fd/0. At that point both MP and CP would have handles open to the stdin/stdout/stderr of WP. You could kill MP to ensure only CP has that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .