> A work around:
>
> On unix, one can pass the full command to "bash -c"
>
> For Example
>
> Process.run('bash', ['-c', 'git mktree < $treeFile']);
This is not a workaround. This is the only way to do it. Redirections or pipes are features of the shell, so if you want to use them, you have to use a shell.
Maybe the documentation could say that Process.start doesn't invoke a shell, but that could confuse some people that don't know what the hell a shell is (like, you know, Windows users :-) ).
> Not sure if generalizing this cross-platform is straight-forward, although it seems node has tried.
My naive try would be:
Process.shell(String cmdLine) {
if (windows) {
return Process.start("cmd", ["/c", cmdLine]);
} else {
return Process.start("sh", ["-c", cmdLine]);
}
}
I'm sure it's more complicated than that, but I'd guess not much.
LT
> Process.shell(String cmdLine)
Oh, I see that there are different methods Process.start and Process.run. In that case, I would use a different name, something like Process.startShell. Or maybe define both Process.startShell and Process.runShell.
I agree they would be useful.
LT