tomerfiliba / plumbum

Plumbum: Shell Combinators

Home Page:https://plumbum.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ShellSession.popen incorrectly processes Commands

vient opened this issue · comments

commented

I think, or I am using it wrong.

Hi, so here https://github.com/tomerfiliba/plumbum/blob/v1.8.1/plumbum/machines/session.py#L280-L283 popen checks if cmd is BaseCommand, if so then calls formulate on it. After that it assumes that full_cmd is string but formulate returns list so popen crashes on full_cmd.strip() afterwards.

Should it be ' '.join(cmd.formulate(1)) on line 281?

commented

If I pass cmd as string by joining it then it works.
There is something strange in cases when ProcessExecutionError is raised though: command line is printed as a bunch of numbers which are ASCII codes of characters from original command. For example, abc becomes 97 98 99.