databio / bulker

Manager for multi-container computing environments
https://bulker.io
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

Allowing both piping and quotes in bulker run #74

Open nsheff opened 3 years ago

nsheff commented 3 years ago

How can I pipe something to bulker run?

In bulker v 0.5.0 you could do:

bulker run pi,demo "pi | cowsay"

And this is even shown in the demo. But this fails in v0.6.0:

bulker run pi,demo "pi | cowsay"
Bulker config: /home/nsheff/Dropbox/env/bulker_config/zither.yaml
Activating crate: pi,demo

/bin/sh: 1: pi | cowsay: not found

The reason is due to this change: https://github.com/databio/bulker/commit/af618459367fdcfe98c4798b79a6b55a669a6015

Right now if you use a quote like "pi | cowsay", bash will parse this as an argument and pass it on to bulker. Bulker recognizes that there's space in there, and so it quotes it. If you don't quote it, and say just pi | cowsay, then bash will pass the pi to bulker but will consume the pipe, so bulker can't pass the piped command within it.

So, the fix to allow quotes is great, but it breaks the ability pass piped commands as quotes. I need to be able to pass quoted, spaced args, that will stay quoted -- but also pass pipes, which should be unquoted.

I do not know a solution to this problem, other than to suggest using bulker activate instead of bulker run for complicated things like this that require quotes or pipes. You can use --echo mode in activate to embed in scripts.

nsheff commented 3 years ago

I updated the demo to avoid the problem with bulker run for now.