@@ -41,7 +41,7 @@ suite('Debugging - Adapter Factory', () => {
4141
4242 const nodeExecutable = undefined ;
4343 const debugAdapterPath = path . join ( EXTENSION_ROOT_DIR , 'bundled' , 'libs' , 'debugpy' , 'adapter' ) ;
44- const pythonPath = path . join ( 'path' , 'to' , ' python' , ' interpreter') ;
44+ const pythonPath = 'path/to/ python/ interpreter' ;
4545 const interpreter = {
4646 architecture : Architecture . Unknown ,
4747 path : pythonPath ,
@@ -291,6 +291,27 @@ suite('Debugging - Adapter Factory', () => {
291291
292292 assert . deepStrictEqual ( descriptor , debugExecutable ) ;
293293 } ) ;
294+ test ( 'Add quotes to interpreter path with spaces' , async ( ) => {
295+ const customAdapterPath = 'custom/debug/adapter/customAdapterPath' ;
296+ const session = createSession ( { debugAdapterPath : customAdapterPath } ) ;
297+ const interpreterPathSpaces = 'path/to/python interpreter with spaces' ;
298+ const interpreterPathSpacesQuoted = `"${ interpreterPathSpaces } "` ;
299+ const debugExecutable = new DebugAdapterExecutable ( interpreterPathSpacesQuoted , [ customAdapterPath ] ) ;
300+
301+ getInterpreterDetailsStub . resolves ( { path : [ interpreterPathSpaces ] } ) ;
302+ const interpreterSpacePath = {
303+ architecture : Architecture . Unknown ,
304+ path : interpreterPathSpaces ,
305+ sysPrefix : '' ,
306+ sysVersion : '' ,
307+ envType : 'Unknow' ,
308+ version : new SemVer ( '3.7.4-test' ) ,
309+ } ;
310+ resolveEnvironmentStub . withArgs ( interpreterPathSpaces ) . resolves ( interpreterSpacePath ) ;
311+ const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
312+
313+ assert . deepStrictEqual ( descriptor , debugExecutable ) ;
314+ } ) ;
294315
295316 test ( 'Use "debugAdapterPython" when specified' , async ( ) => {
296317 const session = createSession ( { debugAdapterPython : '/bin/custompy' } ) ;
0 commit comments