question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plumbum hides stderr of pipes

See original GitHub issue
Type "help", "copyright", "credits" or "license" for more information.
>>> from plumbum.cmd import cat, head
>>> from plumbum import FG
>>> cat['/dev/urndom'] & FG(1)
/bin/cat: /dev/urndom: No such file or directory
>>> (cat['/dev/urndom'] | head['-c', '10']) & FG(retcode=1)
>>>

I would expect to see the standard error output of cat printed to the stderr of the Python process. For instance, zsh shows this:

❯❯❯ /bin/cat /dev/urndom | head -c10
/bin/cat: /dev/urndom: No such file or directory

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wokycommented, Jan 25, 2019

I don’t want to capture stderr. It should be printed to actual sys.stderr and not discarded. If you do in e.g. Bash

foo=$(ls /12345 || echo foo)

you get stdout into $foo but stderr will still be printed to shell’s stderr. Plumbum seems to discard it for no reason.

1reaction
hashbrownciphercommented, Jan 22, 2019

@woky I looked up the docstring for __call__, and found that it says “A shortcut for run(args), returning only the process’ stdout”. I was able to get output going to sys.stderr by doing:

>>> bash['ls /123456 || true'] & FG

If instead capturing stderr is preferred, one can do:

>>> bash.run('ls /123456 || true')
(0, '', "ls: cannot access '/123456': No such file or directory\n")
Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for plumbum.commands.modifiers
Source code for plumbum.commands.modifiers ... Ignore hidden properties. ... BG>`), their stdout/stderr pipes might fill up, causing them to hang.
Read more >
Python Subprocess Module - Running external programs
using stdin.write / stdout.read; using PIPE with check_call/check_output/call ... By merging STDERR into STDOUT, the external program's errors can be hidden ...
Read more >
Hide stderr and pipe stdout in tcsh - linux - Stack Overflow
How can I hide stderr but use stdout in csh script? I'm trying to find occurrences in some file which may exist or...
Read more >
Child process | Node.js v19.3.0 Documentation
By default, pipes for stdin , stdout , and stderr are established between the parent Node.js process and the spawned subprocess. These pipes...
Read more >
What is stdout, stderr, /dev/null and redirection? - YouTube
Surely you've heard other talk about stderr or "Standard Error". Similarly there is "stdout" or "Standard Out". But what do they mean.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found