My extension opens a terminal to run a specific command.
Openning the terminal is not a problem, however, specifying the terminal path is.
I am working on Windows, but my default terminal is git bash. As a consequence, results of path.join
, which contain single backslashes (windows...), used in the command, does not work with git bash.
I want to make sure the windows cmd.exe terminal is used to avoid this problem (all users are on windows, this is not problematic).
The documentation says that we can specify a terminal path. I tried to provide the path of cmd.exe obtained from process.env.COMSPEC
, without success:
console.log(process.env.COMSPEC)
const terminal = vscode.window.createTerminal(
name = "Create Projet", shellPath = process.env.COMSPEC)
Throws:
C:\Windows\system32\cmd.exe
ReferenceError: shellPath is not defined at c:\Users\user\Documents\template-python-cli\vscode\project\out\extension.js:58:55 at processTicksAndRejections (internal/process/task_queues.js:93:5) at async l._executeContributedCommand (c:\Users\user\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111644)
But as the log above says, the value exists.
How can I tell the extension to open cmd.exe
with createTerminal
?