@@ -61,9 +61,6 @@ var usage =
6161var parser = yargs . usage ( usage , cliOptions ) ;
6262var opts = parser . argv ;
6363
64- // Set up event listeners for logging temporarily.
65- toConsole ( log , opts ) ;
66-
6764cli . on ( 'require' , function ( name ) {
6865 log . info ( 'Requiring external module' , ansi . magenta ( name ) ) ;
6966} ) ;
@@ -85,21 +82,22 @@ cli.on('respawn', function(flags, child) {
8582 log . info ( 'Respawned to PID:' , pid ) ;
8683} ) ;
8784
88-
8985function run ( ) {
9086 cli . prepare ( {
9187 cwd : opts . cwd ,
9288 configPath : opts . gulpfile ,
9389 require : opts . require ,
9490 completion : opts . completion ,
9591 } , function ( env ) {
96-
9792 var cfgLoadOrder = [ 'home' , 'cwd' ] ;
9893 var cfg = loadConfigFiles ( env . configFiles [ '.gulp' ] , cfgLoadOrder ) ;
9994 opts = mergeConfigToCliFlags ( opts , cfg ) ;
10095 env = mergeConfigToEnvFlags ( env , cfg ) ;
10196 env . configProps = cfg ;
10297
98+ // Set up event listeners for logging again after configuring.
99+ toConsole ( log , opts ) ;
100+
103101 cli . execute ( env , handleArguments ) ;
104102 } ) ;
105103}
@@ -117,18 +115,16 @@ function handleArguments(env) {
117115 process . env . UNDERTAKER_SETTLE = 'true' ;
118116 }
119117
120- // Set up event listeners for logging again after configuring.
121- toConsole ( log , opts ) ;
122-
123118 if ( opts . help ) {
124119 parser . showHelp ( console . log ) ;
125120 exit ( 0 ) ;
126121 }
127122
123+ // Anything that needs to print outside of the logging mechanism should use console.log
128124 if ( opts . version ) {
129- log . info ( 'CLI version' , cliVersion ) ;
125+ console . log ( 'CLI version' , cliVersion ) ;
130126 if ( env . modulePackage && typeof env . modulePackage . version !== 'undefined' ) {
131- log . info ( 'Local version' , env . modulePackage . version ) ;
127+ console . log ( 'Local version' , env . modulePackage . version ) ;
132128 }
133129 exit ( 0 ) ;
134130 }
0 commit comments