Allow multiple string arguments for exec()
See original GitHub issueI’ve found that I end up doing a lot of messy string concatenation with exec()
commands. It would be nice to allow multiple string arguments that would be joined together with a space, such as:
exec('npm', 'run-script', 'test'); // run "npm run-script test"
This could easily be backwards compatible with the current function since only the first argument is currently a string.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:18 (12 by maintainers)
Top Results From Across the Web
Passing Arguments Using the EXEC Command - IBM
When you invoke a REXX exec either implicitly or explicitly using the EXEC command, you can pass either one or no arguments to...
Read more >How to pass in multiple arguments to execute with .sh script
Show activity on this post. In this example, xargs will execute ./script.sh multiple times with a single argument read from its standard input. ......
Read more >Passing variable as argument for exec.Command()
The following code returns a line with the delimiter (I work on Windows and its EOL is '\r\n'), something that wasn't shown when...
Read more >Adding arguments and options to your Bash scripts - Red Hat
Another is the use of options and option arguments. This article explores these two methods for getting data into the script and controlling ......
Read more >Exec execute commands with two parameters? - Scripts & Rules
In general - yep, you have the right approach. You can only pass one param to exec binding, so must combine everything into...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@nzakas would this syntax work for you?
The concern is that this makes parsing slightly harder, since
exec()
can take options as well as a callback.We’re still working on an implementation in shelljs itself, but I implemented a shelljs extension for node v6+ that addresses some of the security concerns here, while also giving a very convenient syntax: https://github.com/nfischer/shelljs-exec-proxy