@@ -41,7 +41,7 @@ suite('Debugging - Adapter Factory', () => {
41
41
42
42
const nodeExecutable = undefined ;
43
43
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' ;
45
45
const interpreter = {
46
46
architecture : Architecture . Unknown ,
47
47
path : pythonPath ,
@@ -291,6 +291,27 @@ suite('Debugging - Adapter Factory', () => {
291
291
292
292
assert . deepStrictEqual ( descriptor , debugExecutable ) ;
293
293
} ) ;
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
+ } ) ;
294
315
295
316
test ( 'Use "debugAdapterPython" when specified' , async ( ) => {
296
317
const session = createSession ( { debugAdapterPython : '/bin/custompy' } ) ;
0 commit comments