Skip to content

Fix single/double quotes in exec#42

Merged
arturadib merged 2 commits intoshelljs:masterfrom
danielepolencic:master
Dec 1, 2012
Merged

Fix single/double quotes in exec#42
arturadib merged 2 commits intoshelljs:masterfrom
danielepolencic:master

Conversation

@danielepolencic
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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