Fix edgecase in gulpfile.js

There seem's to be an edgecase where a spawned process (in this case node.exe it self) is opened and gulp straight away thinks it closed. At first I thought it was a problem with Gulp, but after fiddleing it seem's to be a Window's problem, so I just updated the `node()` spawner to work on all platforms by using Gulp's callback to create an async task. Problem solved :)
This commit is contained in:
Futago-za Ryuu 2018-01-07 16:32:33 +00:00
parent b0056d7a9f
commit 1b2072f239

View file

@ -17,9 +17,16 @@ const header = require( "gulp-header" );
const del = require( "del" ); const del = require( "del" );
const runSequence = require( "run-sequence" ); const runSequence = require( "run-sequence" );
function node( args ) { function node( args, cb ) {
return spawn( "node", args.split( " " ), { stdio: "inherit" } ); spawn( "node", args.split( " " ), { stdio: "inherit" } )
.on( "error", cb )
.on( "close", code => {
if ( ! code ) cb();
} );
} }
@ -49,12 +56,18 @@ task( "test", () => gulp
); );
// Run benchmarks. // Run benchmarks.
task( "benchmark", () => node( "test/benchmark/run" ) ); task( "benchmark", cb => {
node( "test/benchmark/run", cb );
} );
// Generate the grammar parser. // Generate the grammar parser.
task( "build:parser", () => task( "build:parser", cb => {
node( "bin/peg src/parser.pegjs -o lib/parser.js -c src/config.json" )
); node( "bin/peg src/parser.pegjs -o lib/parser.js -c src/config.json", cb );
} );
// Create the browser build. // Create the browser build.
task( "build:browser", () => { task( "build:browser", () => {