minihost icon indicating copy to clipboard operation
minihost copied to clipboard

Use spawn to launch server process with multiple args

Open eush77 opened this issue 10 years ago • 0 comments

This patch changes the way server process is started when h receives multiple positional arguments.

In this case arguments have already been processed by user shell and treating them as parts of the command string would require users to escape arguments twice.

For example, one would need to use

$ h -- node -e 'require\\(\\"http\\"\\).createServer\\(\\).listen\\(process.env.PORT\\)'

instead of

$ h -- node -e 'require("http").createServer().listen(process.env.PORT)'

With this change, arguments for commands like this are not processed the second time and need not be escaped, and h -- <cmd> (single argument) is equivalent to h -- sh -c <cmd>.

This fixes parts of #11 and #12 related to multiple-arguments form.

eush77 avatar Dec 27 '15 17:12 eush77