I am starting to look into intercepting a running processes output. I know 
how to do this manually by look at /proc/$PID/fd/1 or by using gdb etc. I 
do not want to use os.exec and then join the child processes output with 
the parent. I want to start Process A and capture the output of A in 
Process B.  Does anyone have any advice on where to start or an opinion on 
why I should just use os.exec ? Any advice/help would be great !  

example :

Process A
pid : 1234

output : Hello world 
output : Hello world 
output : Hello world 
output : Hello world 

Process B 
pid : 5678

reads from process A 

output : From B - Hello world 
output : From B - Hello world  
output : From B - Hello world 
output : From B - Hello world  

I don't want to have to exec the process from my go application like this : 

func main() {
    // Replace `ls` (and its arguments) with something more interesting
    cmd := exec.Command("ls", "-l")
    cmd.Stdout = os.Stdout
    cmd.Stderr = os.Stderr
    cmd.Run()
}

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to