www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16591] New: Spawn process on windows fails for npm start

https://issues.dlang.org/show_bug.cgi?id=16591

          Issue ID: 16591
           Summary: Spawn process on windows fails for npm start
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: andre s-e-a-p.de

Following example is working fine on linux but on windows spawn process fails
with an exception. 

I have following folder structure:
./app.d
./js/helloworld.js
./js/package.json

content of helloworld.js:
console.log('hello world');

content of package.json:
{
  "name": "test",
  "version": "1.0.0",
  "scripts": {
    "start": "node helloworld.js"
  }
}

content of app.d
import std.process, std.path, std.file, std.stdio;

void main()
{
  string workDir = buildPath(thisExePath.dirName, "js");
  string[] args = ["npm", "start"];
  spawnProcess(args, std.stdio.stdin, std.stdio.stdout, std.stdio.stderr, null,
std.process.Config.none, workDir);
}

I compile with dmd and then start the application.
On windows spawn process is not able to execute > npm start.
On Ubuntu Linux the application works fine.

To install node on ubuntu:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

For windows there is setup routine available on nodejs.org

--
Oct 04 2016