@@ -23,7 +23,7 @@ export class AndroidProject extends Project {
23
23
const debugProcess : ChildProcess = super . executeDebugCommand ( args ) ;
24
24
const tnsOutputEventEmitter = new EventEmitter ( ) ;
25
25
26
- this . configureReadyEvent ( debugProcess . stdout , tnsOutputEventEmitter , true ) ;
26
+ this . configureReadyEvent ( debugProcess . stdout , tnsOutputEventEmitter , false ) ;
27
27
28
28
return { tnsProcess : debugProcess , tnsOutputEventEmitter } ;
29
29
}
@@ -38,25 +38,23 @@ export class AndroidProject extends Project {
38
38
const debugProcess : ChildProcess = super . executeDebugCommand ( args ) ;
39
39
const tnsOutputEventEmitter : EventEmitter = new EventEmitter ( ) ;
40
40
41
- this . configureReadyEvent ( debugProcess . stdout , tnsOutputEventEmitter , false ) ;
41
+ this . configureReadyEvent ( debugProcess . stdout , tnsOutputEventEmitter , args . indexOf ( '--debug-brk' ) > - 1 ) ;
42
42
43
43
return { tnsProcess : debugProcess , tnsOutputEventEmitter } ;
44
44
}
45
45
46
- protected configureReadyEvent ( readableStream : stream . Readable , eventEmitter : EventEmitter , attach ?: boolean ) : void {
46
+ protected configureReadyEvent ( readableStream : stream . Readable , eventEmitter : EventEmitter , debugBrk ?: boolean ) : void {
47
47
super . configureReadyEvent ( readableStream , eventEmitter ) ;
48
-
49
48
let debugPort = null ;
50
49
51
50
new scanner . StringMatchingScanner ( readableStream ) . onEveryMatch ( new RegExp ( 'device: .* debug port: [0-9]+' ) , ( match : scanner . IMatchFound ) => {
52
51
// device: {device-name} debug port: {debug-port}
53
52
debugPort = parseInt ( ( match . matches [ 0 ] as string ) . match ( '(?:debug port: )([\\d]{5})' ) [ 1 ] , 10 ) ;
54
- if ( attach ) {
55
- // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket
53
+ if ( ! debugBrk ) {
56
54
setTimeout ( ( ) => { eventEmitter . emit ( 'readyForConnection' , debugPort ) ; } , 1000 ) ;
57
55
}
58
56
} ) ;
59
- if ( ! attach ) {
57
+ if ( debugBrk ) {
60
58
new scanner . StringMatchingScanner ( readableStream ) . onEveryMatch ( '# NativeScript Debugger started #' , ( match : scanner . IMatchFound ) => {
61
59
// wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket
62
60
setTimeout ( ( ) => { eventEmitter . emit ( 'readyForConnection' , debugPort ) ; } , 1000 ) ;
0 commit comments