famzah / popen-noshell

A much faster popen() and system() implementation for Linux
68 stars 13 forks source link

Handling of stderr #8

Closed shamblett closed 9 years ago

shamblett commented 9 years ago

I've replaced a popen call I was using with this, works great except in one respect, in my original call I was using this " 2>&1" to pick up both stdout and stderr of my popened command and combine them, now it looks as though this is being ignored and stderr is being attached to the stderr of my calling process. I've looked at ignore_stderr and it is working as this describes, so this is not a bug as such.

Is it possible to detach stderr from the parent process and attach it to the stdout of my called command so I can read these back together?

famzah commented 9 years ago

This is a pending feature in the "wish-list": Make the "ignore_stderr" parameter a mode - ignore, leave unchanged, redirect to stdout. The last "redirect to stdout" isn't implemented, yet. I'll have a look to code in a few days, so that you can test it once done.

shamblett commented 9 years ago

Thanks, I'll do the testing for you

famzah commented 9 years ago

All done. I've renamed the argument to "stderr_mode" but the position is the same. So just use "2" as a value, and you should be able to capture the STDERR output.

shamblett commented 9 years ago

Works perfectly, thanks