3 ms·
JS is marginally better than Python for this, because tools for runtime and package version management are better for Node than for Python (proper lockfiles, lo
by andrewl-hn 5y ago
JS is marginally better than Python for this, because tools for runtime and package version management are better for Node than for Python (proper lockfiles, local package folders, npm bundled with Node for installation, etc.).
Still, zx isn't as nice as Ruby, which has backticks for calling shell as part of the language. So, you don't have to have a separate package installed, just the ruby runtine.
But Perl is even better! Just like Ruby, it comes with backtick shell execution build-in, but unlike Ruby Perl is ubiquitous and is pretty strict about backward compatibility. So, your scripts will just run on all machines you have, no matter what distro you use and how old the machine is (within reason).
- ptx 5y agoZx seems[1] to take advantage of the way template literals work in JS to do proper shell escaping of the parameters to prevent command injection. Is that handled by the Ruby and Perl backtick syntax as well? [1] https://github.com/google/zx/blob/3.0.0/test.mjs#L30-L33 https://github.com/google/zx/blob/3.0.0/test.mjs#L30-L33