Capturing the stderr of xonsh.lib.subprocess.run #5225
Unanswered
Matthieu-LAURENT39
asked this question in
Q&A
Replies: 4 comments 1 reply
-
I tried using
But it failed with |
Beta Was this translation helpful? Give feedback.
0 replies
-
I thought maybe p = xonsh.procs.specs.SubprocSpec(['ls'], stdout=subprocess.PIPE)
p.run()
print(p.stdout) would work, but it just prints -1... |
Beta Was this translation helpful? Give feedback.
0 replies
-
I gave up and used with tempfile.NamedTemporaryFile(mode="w+", encoding="utf8") as f:
ls e> @(f.name) I'll leave the discussion open since it's not a proper fix, but if you have the same issue i had, then this is probably the way to go |
Beta Was this translation helpful? Give feedback.
0 replies
-
Try start from: !(ls 123)
#CommandPipeline(
# stdin=<_io.BytesIO object at 0x110b8e570>,
# stdout=<_io.BytesIO object at 0x110b8f560>,
# stderr=<_io.BytesIO object at 0x110b8ede0>,
# ...
# output='',
# errors="ls: cannot access '123': No such file or directory\n". # <<<<<<<<<<<<<<<<<<<
# )
# And the same with
__xonsh__.subproc_captured_object(['ls', '123'])
# That calls:
# xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to capture the stderr of a command run via
xonsh.lib.subprocess.run
?stdout musn't be captured as it's a TUI app.
And i can't use regular subprocess.run, as i need to access the xonsh environment
Beta Was this translation helpful? Give feedback.
All reactions