@@ -15,6 +15,12 @@ let LineByLineReader = require("line-by-line");
1515
1616const PTVS_FILES = [ "visualstudio_ipython_repl.py" , "visualstudio_py_debugger.py" ,
1717 "visualstudio_py_launcher.py" , "visualstudio_py_repl.py" , "visualstudio_py_util.py" ] ;
18+ const VALID_DEBUG_OPTIONS = [ "WaitOnAbnormalExit" ,
19+ "WaitOnNormalExit" ,
20+ "RedirectOutput" ,
21+ "DebugStdLib" ,
22+ "BreakOnSystemExitZero" ,
23+ "DjangoDebugging" ] ;
1824
1925export class LocalDebugClient extends DebugClient {
2026 protected args : LaunchRequestArguments ;
@@ -92,7 +98,8 @@ export class LocalDebugClient extends DebugClient {
9298
9399 let args = [ ptVSToolsFilePath , processCwd , dbgServer . port . toString ( ) , "34806ad9-833a-4524-8cd6-18ca4aa74f14" ] . concat ( launcherArgs ) ;
94100 if ( this . args . externalConsole === true ) {
95- open ( { wait : false , app : [ pythonPath ] . concat ( args ) , cwd : processCwd , env : environmentVariables } ) . then ( proc => {
101+ const isSudo = Array . isArray ( this . args . debugOptions ) && this . args . debugOptions . some ( opt => opt === 'Sudo' ) ;
102+ open ( { wait : false , app : [ pythonPath ] . concat ( args ) , cwd : processCwd , env : environmentVariables , sudo : isSudo } ) . then ( proc => {
96103 this . pyProc = proc ;
97104 resolve ( ) ;
98105 } , error => {
@@ -144,7 +151,7 @@ export class LocalDebugClient extends DebugClient {
144151 protected buildLauncherArguments ( ) : string [ ] {
145152 let vsDebugOptions = "WaitOnAbnormalExit,WaitOnNormalExit,RedirectOutput" ;
146153 if ( Array . isArray ( this . args . debugOptions ) ) {
147- vsDebugOptions = this . args . debugOptions . join ( "," ) ;
154+ vsDebugOptions = this . args . debugOptions . filter ( opt => VALID_DEBUG_OPTIONS . indexOf ( opt ) >= 0 ) . join ( "," ) ;
148155 }
149156
150157 let programArgs = Array . isArray ( this . args . args ) && this . args . args . length > 0 ? this . args . args : [ ] ;
0 commit comments