sachaos/viddy

Arguments with spaces in watch command are incorrectly split

koterpillar opened this issue · 2 comments

This command gives the tabular output with details:

$ bash -c 'ls -l'
total 0
-rw-r--r--. 1 user user 0 Aug  5 17:23 a
-rw-r--r--. 1 user user 0 Aug  5 17:23 b
-rw-r--r--. 1 user user 0 Aug  5 17:23 c

However, Viddy breaks it, and -l is passed to bash, not ls:

viddy bash -c 'ls -l'

viddy output with just file names

This behavior is present in traditional watch, but I don't actually see a reason for it.

Here the arguments are joined together, which causes the incorrect behavior if some arguments already contain spaces:

https://github.com/sachaos/viddy/blob/0ab3347/snapshot.go#L110

viddy "bash -c 'ls -l'"
watch "bash -c 'ls -l'"