From f22b4510d22a3e7eb01db5509dc81c83b3f12071 Mon Sep 17 00:00:00 2001 From: jpfarias <050781jp> Date: Thu, 4 Jan 2018 10:21:36 +0000 Subject: [PATCH 1/2] Fixes issue #523 while trying to run / debug a pyramid web application on windows platform --- src/client/debugger/Main.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/debugger/Main.ts b/src/client/debugger/Main.ts index a0e2b22dd5d0..a1e97438d498 100644 --- a/src/client/debugger/Main.ts +++ b/src/client/debugger/Main.ts @@ -22,6 +22,7 @@ import { DebugClient } from "./DebugClients/DebugClient"; import { CreateAttachDebugClient, CreateLaunchDebugClient } from "./DebugClients/DebugFactory"; import { BaseDebugServer } from "./DebugServers/BaseDebugServer"; import { PythonProcess } from "./PythonProcess"; +import { IS_WINDOWS } from '../../../common/utils'; const CHILD_ENUMEARATION_TIMEOUT = 5000; @@ -214,11 +215,15 @@ export class PythonDebugger extends DebugSession { catch (ex) { } if (Array.isArray(args.debugOptions) && args.debugOptions.indexOf("Pyramid") >= 0) { + let pserve = "pserve"; + if (IS_WINDOWS) { + pserve = "pserve.exe"; + } if (fs.existsSync(args.pythonPath)) { - args.program = path.join(path.dirname(args.pythonPath), "pserve"); + args.program = path.join(path.dirname(args.pythonPath), pserve); } else { - args.program = "pserve"; + args.program = pserve; } } // Confirm the file exists From 09155e74132768771dadd1f31c32dfec6c64e00b Mon Sep 17 00:00:00 2001 From: jpfarias <050781jp> Date: Thu, 4 Jan 2018 21:45:36 +0000 Subject: [PATCH 2/2] updating code based on comments from DonJayamanne, changed the import path for IS_WINDOWS and made pserve an immediate declared as const --- src/client/debugger/Main.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/client/debugger/Main.ts b/src/client/debugger/Main.ts index a1e97438d498..d7bb501d8df2 100644 --- a/src/client/debugger/Main.ts +++ b/src/client/debugger/Main.ts @@ -22,7 +22,7 @@ import { DebugClient } from "./DebugClients/DebugClient"; import { CreateAttachDebugClient, CreateLaunchDebugClient } from "./DebugClients/DebugFactory"; import { BaseDebugServer } from "./DebugServers/BaseDebugServer"; import { PythonProcess } from "./PythonProcess"; -import { IS_WINDOWS } from '../../../common/utils'; +import { IS_WINDOWS } from './Common/Utils'; const CHILD_ENUMEARATION_TIMEOUT = 5000; @@ -215,10 +215,7 @@ export class PythonDebugger extends DebugSession { catch (ex) { } if (Array.isArray(args.debugOptions) && args.debugOptions.indexOf("Pyramid") >= 0) { - let pserve = "pserve"; - if (IS_WINDOWS) { - pserve = "pserve.exe"; - } + const pserve = IS_WINDOWS ? "pserve.exe" : "pserve"; if (fs.existsSync(args.pythonPath)) { args.program = path.join(path.dirname(args.pythonPath), pserve); }