Open ZLLentz opened 1 year ago
Thanks for digging into this and managing to figure all that out! I should have a chance to reproduce this near the end of today so I can fully understand, and can let you know what I think afterwards.
Thank you! Note that, locally, we're avoiding this now by "not doing that" e.g. not redirecting the print output to the terminal, so I don't consider this to be an "urgent" edge case per se. It can also be avoided by changing the way we launch our screens. But in general, it felt like something we could also do something about on the PyDM side.
Describe the bug
I'm willing to implement a fix here, but I'd like some discussion/guidance first.
I noticed that some of our shell command buttons would "stop working", because our scientists reported that our applications wouldn't launch. I spent some time digging into it and figured out the following:
PyDMShellCommand
button has aredirectCommandOutput
property that, when changed toTrue
, will send the stdout from the encapsulated process to the stdout of the process that contains the button. (When left atFalse
, this output will be dropped instead).ps
, you'll notice that both the pydm process and the subprocess no longer have a TTY assigned to them.OSError
(<class 'OSError'>: [Errno 5] Input/output error
) when trying to print text to the screen.Expected behavior
Steps to Reproduce
PyDMShellCommand
that runs your script withredirectCommandOutput
set toTrue
(checked)pydm my_file.ui &
xterm
to launch a local terminal in a new window.Possible Solution
I had a few things in mind but I want other opinions: - Redirect the subprocess stdout to a function we control, rather than directly to stdout, so we can do some error handling - Rework this widget to always store the output locally in a way that we can check at runtime (separate from other terminal output) **My Platform**OS red hat 7 pydm v1.19.1 python v3.9.15 pyqt v5.12.3
Additional context