File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as settings from '../common/configSettings';
4
4
import { Commands , PythonLanguage } from '../common/constants' ;
5
5
let path = require ( 'path' ) ;
6
6
let terminal : vscode . Terminal ;
7
+ import { IS_WINDOWS } from '../common/utils' ;
7
8
8
9
export function activateExecInTerminalProvider ( ) : vscode . Disposable [ ] {
9
10
const disposables : vscode . Disposable [ ] = [ ] ;
@@ -75,6 +76,14 @@ function execSelectionInTerminal() {
75
76
terminal = terminal ? terminal : vscode . window . createTerminal ( `Python` ) ;
76
77
const launchArgs = settings . PythonSettings . getInstance ( ) . terminal . launchArgs ;
77
78
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
+ }
79
88
terminal . show ( ) ;
80
89
}
You can’t perform that action at this time.
0 commit comments