Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2ed98d

Browse files
committed
fix #387
1 parent 4a29f18 commit e2ed98d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/client/providers/execInTerminalProvider.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as settings from '../common/configSettings';
44
import { Commands, PythonLanguage } from '../common/constants';
55
let path = require('path');
66
let terminal: vscode.Terminal;
7+
import {IS_WINDOWS} from '../common/utils';
78

89
export function activateExecInTerminalProvider(): vscode.Disposable[] {
910
const disposables: vscode.Disposable[] = [];
@@ -75,6 +76,14 @@ function execSelectionInTerminal() {
7576
terminal = terminal ? terminal : vscode.window.createTerminal(`Python`);
7677
const launchArgs = settings.PythonSettings.getInstance().terminal.launchArgs;
7778
const launchArgsString = launchArgs.length > 0 ? " ".concat(launchArgs.join(" ")) : "";
78-
terminal.sendText(`${currentPythonPath}${launchArgsString} -c "${code}"`);
79+
if (IS_WINDOWS) {
80+
// Multi line commands don't work the same way on windows terminals as it does on other OS
81+
// So just start the Python REPL, then send the commands
82+
terminal.sendText(`${currentPythonPath}${launchArgsString}`);
83+
terminal.sendText(code);
84+
}
85+
else {
86+
terminal.sendText(`${currentPythonPath}${launchArgsString} -c "${code}"`);
87+
}
7988
terminal.show();
8089
}

0 commit comments

Comments
 (0)