yoonwaiyan / stackskills-dl

Simple Ruby script to download all StackSkills tutorials.
https://yoonwaiyan.github.io/stackskills-dl/
MIT License
59 stars 19 forks source link

Use system instead of backtics to run commands #34

Closed mizhi closed 6 years ago

mizhi commented 6 years ago

I encountered errors in this script due to the use of ` (backtic). When a file contained a ' (single quote), it would cause errors with the shell commands since the ' would not be properly escaped. Specifically, these errors would look like:

Downloading War_'Xing
sh: 1: Syntax error: Unterminated quoted string

Replacing with Process.spawn version seems to correct these errors.

yoonwaiyan commented 6 years ago

Thanks for the info, but what is the advantage of Process.spawn over system or exec ?

mizhi commented 6 years ago

That's a fair question. My interest was in not using '`' to shell out because of the quoting issue, but exec or system should work too. I'll update the PR to use those instead.

yoonwaiyan commented 6 years ago

Looks good now. Thanks!