From 5c7fbc8f79b0f5c53773ce80bf1a22361ac9c65a Mon Sep 17 00:00:00 2001 From: Eyal Barlev Date: Mon, 17 Jun 2019 09:59:15 +0000 Subject: [PATCH] Ensure node-based debug adapter spawn same node as Theia Signed-off-by: Eyal Barlev --- packages/debug/src/node/debug-adapter-factory.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/debug/src/node/debug-adapter-factory.ts b/packages/debug/src/node/debug-adapter-factory.ts index 62f6ac4acd86d..92b6001023b87 100644 --- a/packages/debug/src/node/debug-adapter-factory.ts +++ b/packages/debug/src/node/debug-adapter-factory.ts @@ -35,7 +35,8 @@ import { CommunicationProvider, DebugAdapterSession, DebugAdapterSessionFactory, - DebugAdapterFactory + DebugAdapterFactory, + DebugAdapterSpawnExecutable } from '../common/debug-model'; import { DebugAdapterSessionImpl } from './debug-adapter-session'; @@ -66,6 +67,12 @@ export class LaunchBasedDebugAdapterFactory implements DebugAdapterFactory { const isForkOptions = (forkOptions: RawForkOptions | any): forkOptions is RawForkOptions => !!forkOptions && !!forkOptions.modulePath; + if (!isForkOptions(executable)) { + if ((executable as DebugAdapterSpawnExecutable).command === 'node') { + (executable as DebugAdapterSpawnExecutable).command = process.execPath; + } + } + const processOptions: RawProcessOptions | RawForkOptions = { ...executable }; const options = { stdio: ['pipe', 'pipe', 2] };