DEV Community

Discussion on: ShellPipe.py | A Hacky Remedy to Overkill Shell Scripting

Collapse
 
xtofl profile image
xtofl

Lovely!

Maybe the pipeline processes could be constructed by the or-chain, and 'ignited' by a sentinel.

sh() | "ls" | "sort" | go()

Collapse
 
taikedz profile image
Tai Kedzierski • Edited

Indeed but if the goal is to "just run" that one command it becomes something like

sh() | "docker-compose down" | go()

Which works, but is a bit meh... and like I said, getting < was low priority given that you could in fact just use an actual file handle.

One thing that is annoying is that Popen() expects a proper file descriptor in stidn - passing in a io.StringIO object fails with MethodNotFoundError on fileno()

I've overloaded OR here, I've overloaded __gt__ and XOR __ge__ to write respectively the process's stdout and stderr to the console, or even a file, it might be time for me to stop... ;-)