66 * found in the LICENSE file at https://angular.io/license
77 */
88
9+ /* tslint:disable:no-console */
910import { spawn } from 'child_process' ;
1011import { platform } from 'os' ;
1112import { normalize } from 'path' ;
@@ -37,6 +38,7 @@ export class TscWatch {
3738 start : string ,
3839 complete : string , onStartCmds ?: Array < string [ ] | Command > , onChangeCmds ?: Array < string [ ] | Command >
3940 } ) {
41+ console . log ( 'Watching:' , tsconfig , 'in' , process . cwd ( ) ) ;
4042 this . tsconfig = tsconfig ;
4143 this . start = start ;
4244 this . error = error ;
@@ -66,12 +68,14 @@ export class TscWatch {
6668 const args = argsOrCmd as Array < string > ;
6769 return < any > new Promise ( ( resolve , reject ) => {
6870 const [ cmd , ...options ] = args ;
71+ console . log ( '=====>' , cmd , options . join ( ' ' ) ) ;
6972 const childProcess = spawn ( cmd , options , { stdio : 'pipe' } ) ;
7073 childProcess . stdout . on ( 'data' , stdOut ) ;
7174 childProcess . stderr . on ( 'data' , stdErr ) ;
7275 const onExit = ( ) => childProcess . kill ( ) ;
7376 childProcess . on ( 'close' , ( code : number ) => {
7477 process . removeListener ( 'exit' , onExit ) ;
78+ console . log ( 'EXIT:' , code , '<=====' , args . join ( ' ' ) ) ;
7579 code ? reject ( code ) : resolve ( code ) ;
7680 } ) ;
7781 process . on ( 'exit' , onExit ) ;
@@ -95,22 +99,23 @@ export class TscWatch {
9599 consumeLine ( buffer : Buffer , isStdError : boolean ) {
96100 const line = '' + buffer ;
97101 if ( contains ( line , this . start ) ) {
102+ console . log ( '==============================================================================' ) ;
98103 stdOut ( buffer , isStdError ) ;
99104 this . state = State . waiting ;
100105 } else if ( contains ( line , this . error ) ) {
101106 stdOut ( buffer , isStdError ) ;
102107 this . state = State . error ;
103108 } else if ( contains ( line , this . complete ) ) {
104109 stdOut ( buffer , isStdError ) ;
110+ console . log ( '------------------------------------------------------------------------------' ) ;
105111 if ( this . state == State . error ) {
106- console . error ( 'Errors found.... (response not triggered)' ) ;
112+ console . log ( 'Errors found.... (response not triggered)' ) ;
107113 if ( this . runOnce ) process . exit ( 1 ) ;
108114 this . state = State . idle ;
109115 } else {
110116 if ( this . triggered ) {
111117 this . triggered . then (
112- ( ) => this . triggerCmds ( ) ,
113- ( e ) => console . error ( 'Error while running commands....' , e ) ) ;
118+ ( ) => this . triggerCmds ( ) , ( e ) => console . log ( 'Error while running commands....' , e ) ) ;
114119 } else {
115120 this . triggerCmds ( ) ;
116121 }
0 commit comments