godaemon icon indicating copy to clipboard operation
godaemon copied to clipboard

Test the stdout/stderr redirection

Open xaprb opened this issue 11 years ago • 2 comments

It would be great to have automated tests that verify that our piped STDERR and STDOUT are working correctly.

xaprb avatar Sep 16 '13 15:09 xaprb

+1 that. I had trouble daemonizing my gopherbot program, and with some help tracked it down to CaptureOutput. The symptom was an http POST hanging until it finally got killed by a SIGPIPE. I think it ended up having multiple threads reading from the same fd.

I was using CaptureOutput to feed stdout/sderr into the log file, but when I disabled that things started working again. If I get more time & motivation, I'll look more, but for now I'm just going to fix the library that's logging to stderr so I don't have to worry about capturing it. Otherwise godaemon is great - I was very happy with the ease of opening the log file in StageParent for later use in the daemon.

parsley42 avatar May 27 '16 18:05 parsley42

@parsley42 - Interesting I find the opposite true... When CaptureOutput is false, calls to net/http Client.Do() hang. With CaptureOutput (true) but nothing reading from the captured output, the app just silently dies. With CaptureOutput(true) and a io.Copy sending it to a file, then it all works fine.

Raised this here https://github.com/golang/go/issues/22165

ArcticSnowman avatar Oct 06 '17 15:10 ArcticSnowman