Skip to content

Commit 18360a0

Browse files
committed
fix #518
1 parent bece528 commit 18360a0

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/client/debugger/DebugClients/LocalDebugClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class LocalDebugClient extends DebugClient {
6666
}
6767
public LaunchApplicationToDebug(dbgServer: IDebugServer, processErrored: (error: any) => void): Promise<any> {
6868
return new Promise<any>((resolve, reject) => {
69-
let fileDir = path.dirname(this.args.program);
69+
let fileDir = this.args && this.args.program ? path.dirname(this.args.program) : '';
7070
let processCwd = fileDir;
7171
if (typeof this.args.cwd === 'string' && this.args.cwd.length > 0 && this.args.cwd !== 'null') {
7272
processCwd = this.args.cwd;

src/client/debugger/Main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ export class PythonDebugger extends DebugSession {
8181
private debugServer: BaseDebugServer;
8282

8383
private startDebugServer(): Promise<IDebugServer> {
84-
let programDirectory = this.launchArgs ? path.dirname(this.launchArgs.program) : this.attachArgs.localRoot;
84+
let programDirectory = '';
85+
if ((this.launchArgs && this.launchArgs.program) || (this.attachArgs && this.attachArgs.localRoot)) {
86+
programDirectory = this.launchArgs ? path.dirname(this.launchArgs.program) : this.attachArgs.localRoot;
87+
}
8588
if (this.launchArgs && typeof this.launchArgs.cwd === 'string' && this.launchArgs.cwd.length > 0 && this.launchArgs.cwd !== 'null') {
8689
programDirectory = this.launchArgs.cwd;
8790
}

0 commit comments

Comments
 (0)