Python execv and pipe output

Viewed 1037

I'd like to use Python's os.execv to replace my current process, but I also want the new process to send stdout to another process (to collect logs and ship them over the network). The process collecting logs also needs to be started by the original Python process.

I'm guessing I need to do some fork, dup2, execv stuff, but I need some help.

In bash, it might look something like this

#!/bin/bash
exec ./foo ∣ ./bar
1 Answers
Related