Permalink
Browse files

fix: command can be run on Windows (#13)

  • Loading branch information...
popomore committed Apr 15, 2018
1 parent ab29dee commit 2475b7c54fe088e2469181eb63f1a48c7c94fdbf
@@ -1,6 +1,6 @@
'use strict';

const cp = require('child_process');
const spawn = require('cross-spawn');
const Base = require('sdk-base');
const detect = require('detect-port');
const sleep = require('mz-modules/sleep');
@@ -40,7 +40,7 @@ class DevServer extends Base {
env,
};
if (devServer.cwd) opt.cwd = devServer.cwd;
const proc = this.proc = cp.spawn(command, args, opt);
const proc = this.proc = spawn(command, args, opt);

let stderr = '';
proc.stderr.on('data', data => {
@@ -16,6 +16,7 @@
],
"dependencies": {
"await-event": "^2.1.0",
"cross-spawn": "^6.0.5",
"debug": "^3.1.0",
"detect-port": "^1.2.2",
"mz": "^2.7.0",
@@ -26,10 +27,10 @@
"devDependencies": {
"autod": "^3.0.1",
"autod-egg": "^1.1.0",
"egg": "^2.5.0",
"egg-bin": "^4.5.0",
"egg": "^2.6.1",
"egg-bin": "^4.6.3",
"egg-ci": "^1.8.0",
"egg-mock": "^3.16.0",
"egg-mock": "^3.17.0",
"egg-view-ejs": "^2.0.0",
"egg-view-nunjucks": "^2.1.6",
"eslint": "^4.19.1",
@@ -21,7 +21,7 @@ describe('test/dev_server.test.js', () => {
});
app.debug();
await app.ready();
const reg = new RegExp(`Run "node ${path.join(__dirname, 'fixtures/apps/mocktool/server')}" success, listen on 8000`);
const reg = new RegExp(`Run "node ${path.join(__dirname, 'fixtures/apps/mocktool/server.js')}" success, listen on 8000`);
app.expect('stdout', reg);

await app.close();
@@ -13,7 +13,7 @@ exports.assets = {
templateViewEngine: 'nunjucks',
devServer: {
waitStart: true,
command: 'node ' + path.join(__dirname, '../../mocktool/server'),
command: 'node ' + path.join(__dirname, '../../mocktool/server.js'),
port: 8000,
env: {},
debug: true,
@@ -13,7 +13,7 @@ exports.assets = {
publicPath: '/app/public',
devServer: {
waitStart: true,
command: 'node ' + path.join(__dirname, '../../mocktool/server'),
command: 'node ' + path.join(__dirname, '../../mocktool/server.js'),
port: 8000,
env: {},
debug: true,
@@ -11,7 +11,7 @@ exports.view = {
exports.assets = {
devServer: {
waitStart: true,
command: 'node ' + path.join(__dirname, '../../mocktool/server'),
command: 'node ' + path.join(__dirname, '../../mocktool/server.js'),
port: 8000,
env: {},
debug: true,
@@ -12,7 +12,7 @@ exports.assets = {
contextKey: '__context__',
devServer: {
waitStart: true,
command: 'node ' + path.join(__dirname, '../../mocktool/server'),
command: 'node ' + path.join(__dirname, '../../mocktool/server.js'),
port: 8000,
env: {},
debug: true,
@@ -1,5 +1,3 @@
#!/usr/bin/env node

'use strict';

const http = require('http');
@@ -12,7 +12,7 @@ exports.assets = {
publicPath: '/app/public',
devServer: {
waitStart: true,
command: 'node ' + path.join(__dirname, '../../mocktool/server'),
command: 'node ' + path.join(__dirname, '../../mocktool/server.js'),
port: 8000,
env: {},
},

0 comments on commit 2475b7c

Please sign in to comment.