Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of special characters #79

Open
deployable opened this issue Feb 12, 2016 · 1 comment
Open

Handling of special characters #79

deployable opened this issue Feb 12, 2016 · 1 comment

Comments

@deployable
Copy link

There's doesn't appear to be any handling of special shell characters in gift when options and arguments are passed to bash.

A path with spaces or special characters in the arguments will blow up with

Unhandled rejection Error: spawn /bin/sh ENOENT
    at exports._errnoException (util.js:874:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:439:9)
    at process._tickCallback (node.js:353:17)

Unhandled rejection Error: ENOENT: no such file or directory, open '/app/fixture/re po/event_rules_spec.yml.saved'
    at Error (native)

Trying to escape paths at the front end causes more issues so I think it needs to be handled in gift.

The Shellwords module from ruby has the most useful shellescape implementation I've used.

The best nodejs example I could find is on stack:

'"' + cmd.replace(/(["\s'$`\\])/g,'\\$1') + '"'

Do all exec calls in gift go through the git function? Is it normally args that would pass path/file names?

@deployable
Copy link
Author

Actually, using spawn is probably a much better way to deal with this. No shell shenanigans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant