[Python API] Support directing STDOUT and STDERR when using Logic2 API

Seems like you override stdout and stderr when executing logic2 binary,
any chance to allow optional support for passing stream handlers (or buffers) for fetching stdout/err ?

process = subprocess.Popen([logic2_bin, ‘–automation’, ‘–automationPort’, str(_DEFAULT_GRPC_PORT)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)

@itay.work94 Sorry for the trouble with that. I’m not immediately familiar with this behavior. However, I’ll chat with the software team about this and we can share our thoughts and recommendations.

Hi @itay.work94,

I think we would consider adding support for forwarding arguments to Popen, similar to what we provide for the grpc channel options. What do you think about that?

Also, out of curiosity, what is your use-case for needing stdout/err from Logic2?

Ryan

that would be great!

the thing is the Saleae we use being executed via automation and in the past we’ve seen where it gets into “brick” state, (device enumerates OS-wise but logic doesnt recognize it).
so as part of troubleshooting and debugging thought capturing stdout and err for logging purpose to see whether its something we can pin-point to the root cause or perhaps pass it forward to you guys

To be honest, I’m not exactly sure how our stdout/stderr is setup right now. One thing that complicates our output is that although the launched binary produces some output, most of the logging our application does is produced by a subprocess. I was looking into this somewhat recently, because it’s particularly hard to access the complete log output on Linux, even when running the application from the command line.

What operating system are you using?

Unfortunately, I won’t have time to look into this for a while, the whole team is swamped at the moment. However, it might be worth checking to see if stdout/stderr can be captured from all of our application’s sub processes, rather than just the main process itself.