New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
capture process output into history window #31
Comments
Capture is working on Windows but not on Linux for processes that do not immediately return a response, such as caQtDM startup. Looks as if those process quit early; caQtDM does not start. When the caQtDM starter fails here's how:
But the external script command works both from the command line and from So, revert back to the class Capture_stdout(list):
'''
capture all printed output (to stdout) into list
# http://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call
'''
def __enter__(self):
sys.stdout.flush()
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
return self
def __exit__(self, *args):
self.extend(self._stringio.getvalue().splitlines())
del self._stringio # free up some memory
sys.stdout = self._stdout and calling it with something such as: with Capture_stdout() as printed_lines:
do_something_that_writes_stdout() then see: http://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call |
The correct way to do this is to make the history panel be a View of the history text buffer (the Model). As the model is updated, the view will refresh. |
yet, some processes (such IOC console status) do not start: starting /home/prjemian/Documents/eclipse/bcdamenu/runner.py ... (re)load settings: /home/prjemian/bin/bcdamenu.ini BcdaMenu (2017-04-23 11:38:41.663257), IOC status: export EPICS_HOST_ARCH=linux-x86_64; cd /opt/epics/synApps/support/xxx-R5-8-3/iocBoot/iocLinux; ./xxx.sh status state: 1 pid: 30278 error: id_1 state: 0 error string: No such file or directory last error code: 0 exitCode: 255 exitStatus: 0
when a process is run now, its output goes to the console
Capture that and add to history window
The text was updated successfully, but these errors were encountered: