diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index bc7534b9d..fc66ab193 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -12,7 +12,7 @@ exports.BasePackageManager = class { run(command, args = [], workingDirectory = process.cwd()) { return new Promise((resolve, reject) => { - spawn( + this.proc = spawn( this.getExecutablePath(workingDirectory), [command, ...args], { stdio: 'inherit', cwd: workingDirectory } diff --git a/skeleton/webpack/aurelia_project/tasks/run.ext b/skeleton/webpack/aurelia_project/tasks/run.ext index 88f85bfd9..8987e7f98 100644 --- a/skeleton/webpack/aurelia_project/tasks/run.ext +++ b/skeleton/webpack/aurelia_project/tasks/run.ext @@ -2,12 +2,13 @@ import { NPM } from 'aurelia-cli'; import { CLIOptions } from 'aurelia-cli'; import * as project from '../aurelia.json'; -var find = require('find-process'); var kill = require('tree-kill'); const port = CLIOptions.getFlagValue('port') || project.platform.port; const host = CLIOptions.getFlagValue('host') || project.platform.host || "localhost"; +const npm = new NPM(); + const run = () => { console.log('`au run` is an alias of the `npm start`, you may use either of those; see README for more details.'); @@ -22,19 +23,16 @@ const run = () => { args.push(host); } - return (new NPM()).run('start', ['--', ...args]); + return npm.run('start', ['--', ...args]); } const shutdownAppServer = () => { return new Promise(resolve => { - find('port', port) - .then(function (list) { - if (list.length) { - kill(list[0].pid, 'SIGKILL', function (err) { + if(npm.proc){ + kill(npm.proc.pid, 'SIGKILL', function (err) { resolve(); }); - } - }); + } }); }; diff --git a/skeleton/webpack/package.json b/skeleton/webpack/package.json index 9a64c26b1..32fa4f47e 100644 --- a/skeleton/webpack/package.json +++ b/skeleton/webpack/package.json @@ -68,7 +68,6 @@ "html-loader": "", "istanbul-instrumenter-loader": "", "webpack-bundle-analyzer": "", - "find-process": "^1.4.2", "tree-kill": "^1.2.1", }, "scripts": {