forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Running python code without debugging using the experimental debugger (…
…#1373) Fixes #882 Remove python file used to launch the PTVSD debugger Added ability to run code without debugging using PTVSD Launching PTVSD using -m (run as a python module)
- Loading branch information
1 parent
62d7b38
commit 157f392
Showing
10 changed files
with
220 additions
and
122 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import { DebugSession } from 'vscode-debugadapter'; | ||
import { LaunchRequestArguments } from '../Common/Contracts'; | ||
import { IDebugLauncherScriptProvider } from '../types'; | ||
import { LocalDebugClient } from './LocalDebugClient'; | ||
|
||
export class LocalDebugClientV2 extends LocalDebugClient { | ||
constructor(args: LaunchRequestArguments, debugSession: DebugSession, canLaunchTerminal: boolean, launcherScriptProvider: IDebugLauncherScriptProvider) { | ||
super(args, debugSession, canLaunchTerminal, launcherScriptProvider); | ||
} | ||
protected buildDebugArguments(cwd: string, debugPort: number): string[] { | ||
const noDebugArg = this.args.noDebug ? ['--nodebug'] : []; | ||
return ['-m', 'ptvsd', ...noDebugArg, '--host', 'localhost', '--port', debugPort.toString()]; | ||
} | ||
protected buildStandardArguments() { | ||
const programArgs = Array.isArray(this.args.args) && this.args.args.length > 0 ? this.args.args : []; | ||
if (typeof this.args.module === 'string' && this.args.module.length > 0) { | ||
return ['-m', this.args.module, ...programArgs]; | ||
} | ||
if (this.args.program && this.args.program.length > 0) { | ||
return ['--file', this.args.program, ...programArgs]; | ||
} | ||
return programArgs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import { ChildProcess } from 'child_process'; | ||
import { DebugSession } from 'vscode-debugadapter'; | ||
import { LaunchRequestArguments } from '../Common/Contracts'; | ||
import { IDebugLauncherScriptProvider } from '../types'; | ||
import { DebugType } from './DebugClient'; | ||
import { LocalDebugClientV2 } from './localDebugClientV2'; | ||
|
||
export class NonDebugClientV2 extends LocalDebugClientV2 { | ||
constructor(args: LaunchRequestArguments, debugSession: DebugSession, canLaunchTerminal: boolean, launcherScriptProvider: IDebugLauncherScriptProvider) { | ||
super(args, debugSession, canLaunchTerminal, launcherScriptProvider); | ||
} | ||
|
||
public get DebugType(): DebugType { | ||
return DebugType.RunLocal; | ||
} | ||
|
||
public Stop() { | ||
super.Stop(); | ||
if (this.pyProc) { | ||
try { | ||
this.pyProc!.kill(); | ||
// tslint:disable-next-line:no-empty | ||
} catch { } | ||
this.pyProc = undefined; | ||
} | ||
} | ||
protected handleProcessOutput(proc: ChildProcess, _failedToLaunch: (error: Error | string | Buffer) => void) { | ||
// Do nothing | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.