diff --git a/appWatcher.js b/appWatcher.js index fb47b98..2cf654e 100755 --- a/appWatcher.js +++ b/appWatcher.js @@ -6,7 +6,7 @@ ipc.config.silent = true; let appProc; function watchIt([command, ...rest]) { - appProc = spawn(myArgs[0], rest); + appProc = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['run', myArgs[0]]); appProc.stdout.on("data", data => { let stringifiedData = data.toString(); @@ -26,7 +26,7 @@ function watchIt([command, ...rest]) { } process.on("uncaughtException", exception => { - process.kill(appProc.pid); + process.exit(appProc.pid); // switched kill to exit, else invalid pid error on windows throw new Error(exception); }); diff --git a/package.json b/package.json index 822bbef..23e4536 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,12 @@ "dependencies": { "@cypress/browserify-preprocessor": "^1.1.0", "node-ipc": "^9.1.1" + }, + "scripts": { + "cydev": "cross-env WAIT_FOR_MESSAGE=\"Compiled successfully\" cypressAppWatcher start" + }, + "devDependences":{ + "cross-env": "^5.2.0", }, "keywords": [ "cypress",