File tree Expand file tree Collapse file tree 4 files changed +21
-9
lines changed
Expand file tree Collapse file tree 4 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ var cli = new Liftoff({
2929var failed = false ;
3030process . once ( 'exit' , function ( code ) {
3131 if ( code === 0 && failed ) {
32- process . exit ( 1 ) ;
32+ exit ( 1 ) ;
3333 }
3434} ) ;
3535
@@ -78,7 +78,7 @@ function handleArguments(env) {
7878 if ( env . modulePackage && typeof env . modulePackage . version !== 'undefined' ) {
7979 gutil . log ( 'Local version' , env . modulePackage . version ) ;
8080 }
81- process . exit ( 0 ) ;
81+ exit ( 0 ) ;
8282 }
8383
8484 if ( ! env . modulePath ) {
@@ -87,12 +87,12 @@ function handleArguments(env) {
8787 chalk . magenta ( tildify ( env . cwd ) )
8888 ) ;
8989 gutil . log ( chalk . red ( 'Try running: npm install gulp' ) ) ;
90- process . exit ( 1 ) ;
90+ exit ( 1 ) ;
9191 }
9292
9393 if ( ! env . configPath ) {
9494 gutil . log ( chalk . red ( 'No gulpfile found' ) ) ;
95- process . exit ( 1 ) ;
95+ exit ( 1 ) ;
9696 }
9797
9898 // check for semver difference between cli and local installation
@@ -207,6 +207,17 @@ function logEvents(gulpInst) {
207207 chalk . red ( 'Task \'' + err . task + '\' is not in your gulpfile' )
208208 ) ;
209209 gutil . log ( 'Please check the documentation for proper gulpfile formatting' ) ;
210- process . exit ( 1 ) ;
210+ exit ( 1 ) ;
211211 } ) ;
212212}
213+
214+ // fix stdout truncation on windows
215+ function exit ( code ) {
216+ if ( process . platform === 'win32' && process . stdout . bufferSize ) {
217+ process . stdout . once ( 'drain' , function ( ) {
218+ process . exit ( code ) ;
219+ } ) ;
220+ return ;
221+ }
222+ process . exit ( code ) ;
223+ }
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ var code = require('code');
66var fs = require ( 'fs' ) ;
77var child = require ( 'child_process' ) ;
88
9- var output = fs . readFileSync ( __dirname + '/expected/flags-tasks-simple.txt' , 'utf8' ) ;
9+ var output = fs . readFileSync ( __dirname + '/expected/flags-tasks-simple.txt' , 'utf8' ) . replace ( / \r \n / g , '\n' ) ;
1010
1111lab . experiment ( 'flag: --tasks-simple' , function ( ) {
1212
1313 lab . test ( 'prints the task list' , function ( done ) {
14- child . exec ( __dirname + '/../index.js --tasks-simple --cwd ./test' , function ( err , stdout ) {
14+ child . exec ( 'node ' + __dirname + '/../index.js --tasks-simple --cwd ./test' , function ( err , stdout ) {
1515 code . expect ( stdout ) . to . equal ( output ) ;
1616 done ( err ) ;
1717 } ) ;
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ var child = require('child_process');
88lab . experiment ( 'flag: --tasks' , function ( ) {
99
1010 lab . test ( 'prints the task list' , function ( done ) {
11- child . exec ( __dirname + '/../index.js --tasks --cwd ./test' , function ( err , stdout ) {
11+ child . exec ( 'node ' + __dirname + '/../index.js --tasks --cwd ./test' , function ( err , stdout ) {
12+ stdout = stdout . replace ( / \\ / g, '/' ) ;
1213 code . expect ( stdout ) . to . contain ( '/gulp-cli/test' ) ;
1314 code . expect ( stdout ) . to . contain ( '├── test1' ) ;
1415 code . expect ( stdout ) . to . contain ( '├── test2' ) ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ var gulpVersion = require('gulp/package.json').version;
1111lab . experiment ( 'flag: --version' , function ( ) {
1212
1313 lab . test ( 'prints the task list' , function ( done ) {
14- child . exec ( __dirname + '/../index.js --version --cwd ./test' , function ( err , stdout ) {
14+ child . exec ( 'node ' + __dirname + '/../index.js --version --cwd ./test' , function ( err , stdout ) {
1515 code . expect ( stdout ) . to . contain ( 'CLI version ' + cliVersion ) ;
1616 code . expect ( stdout ) . to . contain ( 'Local version ' + gulpVersion ) ;
1717 done ( err ) ;
You can’t perform that action at this time.
0 commit comments