Hi all,
I have an outline with some @button nodes that fire off external shell
commands using g.execute_shell_commands. I tend to run Leo *without* a
console window open, so anything those @button-triggered shell commands
print to the console is lost to me. Is there an easy way/straightforward
way to redirect to the stdout/stderr for those commands only to the log
pane? I'm struggling to figure it out by manipulating sys.stdout and
sys.stderr, though I admit this is far from my area of specialty.
An example of a button:
```
@language python
@tabwidth -2
''' Executes the currently selected sketch with the 'vsk run' command.
'''
import os.path
fn = c.getNodeFileName(p)
if len(fn) == 0:
# non-external file selected
g.es('Not a valid sketch node.', color='red')
else:
sketch_path = os.path.dirname(fn)
g.execute_shell_commands(f'&vsk run {sketch_path}')
```
That command is long-running (i.e. it stays open in another pane, thus the
'&' to unblock the Leo GUI). Sometimes it indicates errors on the console
output, which just plain doesn't exist when I'm running Leo without a
console window open.
Ideally any solution would be cross-platform, since I do this on both
Windows and Linux... but really I'd be happy with platform-specific
solutions too. I'd really rather not have to have a console window open to
see these errors if at all possible.
Thanks in advance for any ideas and suggestions,
Jake
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/CAJ1i%2BSb8CcaDw_%2B8sViU2buHU4_5Rx7_11hioQGjWK9w9tvYUQ%40mail.gmail.com.