@@ -494,7 +494,10 @@ export class RawDebugSession {
494494
495495 switch ( request . command ) {
496496 case 'launchVSCode' :
497- this . launch ( < ILaunchVSCodeArguments > request . arguments ) . then ( _ => {
497+ this . launchVsCode ( < ILaunchVSCodeArguments > request . arguments ) . then ( pid => {
498+ response . body = {
499+ processId : pid
500+ } ;
498501 safeSendResponse ( response ) ;
499502 } , err => {
500503 response . success = false ;
@@ -539,41 +542,40 @@ export class RawDebugSession {
539542 }
540543 }
541544
542- private launch ( VSCodeArgs : ILaunchVSCodeArguments ) : Promise < void > {
543-
545+ private launchVsCode ( args : ILaunchVSCodeArguments ) : Promise < number > {
544546
545547 const spawnOpts : cp . SpawnOptions = {
546548 detached : false // https://github.com/Microsoft/vscode/issues/57018
547549 } ;
548550
549- if ( VSCodeArgs . env ) {
551+ if ( args . env ) {
550552 // merge environment variables into a copy of the process.env
551- const envArgs = objects . mixin ( objects . mixin ( { } , process . env ) , VSCodeArgs . env ) ;
553+ const envArgs = objects . mixin ( objects . mixin ( { } , process . env ) , args . env ) ;
552554 // and delete some if necessary
553555 Object . keys ( envArgs ) . filter ( k => envArgs [ k ] === null ) . forEach ( key => delete envArgs [ key ] ) ;
554556 spawnOpts . env = envArgs ;
555557 }
556558
557- let spawnArgs = [ ] . concat ( VSCodeArgs . options ) ;
559+ let spawnArgs = [ ] . concat ( args . options ) ;
558560
559- switch ( VSCodeArgs . debugMode ) {
561+ switch ( args . debugMode ) {
560562 case 'noDebug' :
561563 break ;
562564 case 'break' :
563- spawnArgs . push ( `--inspect-brk-extensions=${ VSCodeArgs . debugPort } ` ) ;
565+ spawnArgs . push ( `--inspect-brk-extensions=${ args . debugPort } ` ) ;
564566 break ;
565567 case 'noBreak' :
566- spawnArgs . push ( `--inspect-extensions=${ VSCodeArgs . debugPort } ` ) ;
568+ spawnArgs . push ( `--inspect-extensions=${ args . debugPort } ` ) ;
567569 break ;
568570 }
569571
570572 // pass the debug session ID to the EH so that broadcast events know where they come from
571- if ( VSCodeArgs . sessionId ) {
572- spawnArgs . push ( `--debugId=${ VSCodeArgs . sessionId } ` ) ;
573+ if ( args . sessionId ) {
574+ spawnArgs . push ( `--debugId=${ args . sessionId } ` ) ;
573575 }
574576
575- if ( VSCodeArgs . extensionDevelopmentPath ) {
576- spawnArgs . push ( `--extensionDevelopmentPath=${ VSCodeArgs . extensionDevelopmentPath } ` ) ;
577+ if ( args . extensionDevelopmentPath ) {
578+ spawnArgs . push ( `--extensionDevelopmentPath=${ args . extensionDevelopmentPath } ` ) ;
577579 }
578580
579581 let runtimeExecutable = this . environmentService [ 'execPath' ] ;
@@ -588,12 +590,12 @@ export class RawDebugSession {
588590 const vscodeWorkspacePath = runtimeExecutable . substr ( 0 , electronIdx ) ;
589591
590592 // only add path if user hasn't already added that path
591- if ( VSCodeArgs . pathArgs . length === 0 || VSCodeArgs . pathArgs [ 0 ] . path . indexOf ( vscodeWorkspacePath ) !== 0 ) {
593+ if ( args . pathArgs . length === 0 || args . pathArgs [ 0 ] . path . indexOf ( vscodeWorkspacePath ) !== 0 ) {
592594 spawnArgs . push ( vscodeWorkspacePath ) ;
593595 }
594596 }
595597
596- VSCodeArgs . pathArgs . forEach ( p => {
598+ args . pathArgs . forEach ( p => {
597599 switch ( p . type ) {
598600 case 'file' :
599601 spawnArgs . push ( `--file-uri=${ p . path } ` ) ;
@@ -629,14 +631,14 @@ export class RawDebugSession {
629631 }
630632 }
631633
632- return new Promise < void > ( ( resolve , reject ) => {
634+ return new Promise ( ( resolve , reject ) => {
633635 const process = cp . spawn ( runtimeExecutable , spawnArgs , spawnOpts ) ;
634636 process . on ( 'error' , error => {
635637 reject ( error ) ;
636638 } ) ;
637639 process . on ( 'exit' , code => {
638640 if ( code === 0 ) {
639- resolve ( ) ;
641+ resolve ( process . pid ) ;
640642 } else {
641643 reject ( new Error ( `VS Code exited with ${ code } ` ) ) ;
642644 }
0 commit comments