guard/guard-process

Support for arguments with spaces

Closed this issue · 1 comments

The current code does a .split(" ") on the string passed as :command. This makes it impossible to pass arguments with spaces to the underlying command.

A possible fix would be to accept either a string or an array, the latter to be used when you need to split the arguments in a different way than with spaces.

This is the workaround I'm currently using: it's a fake array that accepts the split method, does nothing, and returns itself.

class Args < Array
    def split(dummy)
        self
    end
end

guard :process, :command => (Args)['foo', '-bar', '-b', 'arg with embedded spaces'] do
    watch('something')
end

I've made the required modifications to allow using an Array as well as a String to specify the command and pushed a new gem to rubygems.org