Skip to content
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

ProcessExecutionError is misleading when piped commands fail #241

Closed
hashbrowncipher opened this issue Nov 9, 2015 · 2 comments
Closed
Labels
Milestone

Comments

@hashbrowncipher
Copy link
Contributor

Relates to #145

Type "help", "copyright", "credits" or "license" for more information.
>>> from plumbum.cmd import cat, head
>>> from plumbum import FG
>>> (cat['/dev/urndom'] | head['-c', '10']) & FG()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/modifiers.py", line 143, in __rand__
    cmd(retcode = self.retcode, stdin = None, stdout = None, stderr = None)
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/base.py", line 89, in __call__
    return self.run(args, **kwargs)[1]
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/base.py", line 219, in run
    return p.run()
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/base.py", line 181, in runner
    return run_proc(p, retcode, timeout)
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/processes.py", line 217, in run_proc
    return _check_process(proc, retcode, timeout, stdout, stderr)
  File "/nail/home/josnyder/consul-backups/env/local/lib/python2.7/site-packages/plumbum/commands/processes.py", line 34, in _check_process
    stdout, stderr)
plumbum.commands.processes.ProcessExecutionError: Command line: ['/usr/bin/head', '-c', '10']
Exit code: 1

In this example, the process which failed is the cat process. The exception message is misleading, because it implies that the head process failed.

hashbrowncipher pushed a commit to hashbrowncipher/plumbum that referenced this issue Nov 9, 2015
@henryiii henryiii self-assigned this Nov 10, 2015
@henryiii henryiii added this to the v1.6.1 milestone Nov 10, 2015
@henryiii henryiii added the Bug label Nov 10, 2015
@hashbrowncipher
Copy link
Contributor Author

@henryiii, I tidied up my original commit into a PR, but I see you've assigned this issue to yourself. If you have a better solution than mine, by all means go for it.

@henryiii
Copy link
Collaborator

No, go ahead!

@henryiii henryiii removed their assignment Nov 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants