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

Fix single/double quotes in exec #42

Merged
merged 2 commits into from
Dec 1, 2012
Merged

Fix single/double quotes in exec #42

merged 2 commits into from
Dec 1, 2012

Conversation

danielepolencic
Copy link
Contributor

when exec runs a command with quotes and double quotes, the old escape function escaped everything as double quotes. E.g.

exec( "curl -XPUT 'http://localhost:9200/index/node' -d '{"key":"value"}' " )

becomes

curl -XPUT "http://localhost:9200/index/node" -d "{"key":"value"}"

and the new script fails. The new escape function adds backslashes (like PHP addslashes).

Should hopefully fix Issue #11

@arturadib
Copy link
Collaborator

hi superb - any chance you can create a test for this in test/exec? maybe create a test that would fail previously but that passes now? many thanks!

@danielepolencic
Copy link
Contributor Author

I made the test.

this string

"'+'_'+'"

becomes

"_"

with the old escaping function, but stays the same the the new one.

@arturadib
Copy link
Collaborator

superb thanks, and sorry for the delay!

arturadib added a commit that referenced this pull request Dec 1, 2012
Fix single/double quotes in exec
@arturadib arturadib merged commit 35211d0 into shelljs:master Dec 1, 2012
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

Successfully merging this pull request may close these issues.

2 participants