Cannot spawn process: npm start

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 4 21:39:34 PDT 2016


On Tuesday, 4 October 2016 at 18:41:16 UTC, FreeSlave wrote:
> On Tuesday, 4 October 2016 at 17:02:34 UTC, Adam D. Ruppe wrote:
>> On Tuesday, 4 October 2016 at 16:55:22 UTC, Andre Pany wrote:
>>> Spawn process is working fine on linux, only on windows it 
>>> doesn't work.
>>> I will create a bug report.
>>
>> This isn't really a bug if it is a cmd file like the other 
>> poster said... cmd files are scripts that need to be run 
>> through the interpreter.
>>
>> shellExec probably handles it, or you could spawnProcess "cmd" 
>> with the npm being an argument to it.
>
> There's no shellExec, but executeShell.
> spawnShell would fit better since author used spawnProcess in 
> original post.
>
> Whether spawnProcess should handle .bat and .cmd is a matter of 
> function design really. Actually I would like to treat 
> spawnProcess more like double-click on application and 
> double-click works for scripts on windows. So there will be no 
> special code for phobos user to handle this case.

I found the trick. If I change args to ["npm.cmd", "start"] it 
will work.
I do not know whether spawnProcess should handle npm vs npm.cmd 
automatically.
Should I close the bug report?

In the beginning I used executeShell, but had some issue to stop 
the started
server applications. Somehow the server applications weren't
stopped although kill and wait were executed. The same scenario 
is working fine
with spawnProcess.

Kind regards
André


More information about the Digitalmars-d-learn mailing list