thoughtbot / terrapin

Run shell commands safely, even with user-supplied values
Other
244 stars 20 forks source link

Is there any way that to pass STDIN into `line.run`? #28

Open cdesch opened 6 months ago

cdesch commented 6 months ago

Is there any way to pass data into line.run as STDIN? Similar to using the pipe operator | in CLI apps like ls | grep '\.txt$', where the output of the command ls is directed as STDIN to grep?

using the `ls | grep '\.txt$' example, that would be inserting whatever I'd want to pass into grep as STDIN somewhere when running the command:

line = Terrapin::CommandLine.new("grep", "'\.txt$'")
line.run 

If it is by design to to exclude the ability for passing STDIN using Terrapin because of saftey, that would be good to know. A different tool may be a better option to do what I'm trying to do, such as IO.popen.