piotrmurach/tty-command

Escaping command

piotrmurach opened this issue · 4 comments

Escaping can be a challenge with the current syntax. What should this do?
cmd.execute(:ls, "hello world")

[71555-047a57b2] Running ls hello world
[71555-047a57b2]    ls: hello: No such file or directory
[71555-047a57b2]    ls: world: No such file or directory
[71555-047a57b2] Finished in 0.002 seconds with exit status 1 (failed)

Sure you can execute the command the way you have mentioned. The readme is definitely not comprehensive yet. If you run cmd.execute("ls -la > output") it will respect the redirect and execute the string as is. There are many ways to pass the arguments which try to mimic the spawn behaviour.

This is probably worth some further discussion. We might want to mimic the current Ruby behavior:

>> system("ls", "hello world")
ls: hello world: No such file or directory

Agree mimicking Ruby behaviour.

Do you have time to work on this?