Adds custom terminal launch settings#3495
Adds custom terminal launch settings#3495Tyriar merged 8 commits intomicrosoft:masterfrom pflannery:open-custom-win-terminal
Conversation
|
Hi @pflannery, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
|
@pflannery, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
|
A couple of things
|
|
@joaomoreno I've added a terminal configuration extension point for windows and linux which allows them to override the default shell launch by vscode. |
|
@pflannery any thoughts on how we could have fallback terminal emulators on Linux? We will eventually want to have at least 2 such as I also noticed while doing a little research in to #4478 that gnome has something similar to the alternatives system in Debian for specifying a preferred terminal: |
|
@Tyriar could use |
- ensures terminal default is used when the terminal setting is removed
|
could have |
|
@pflannery nice improvement! Ideally it would only revert to |
|
@pflannery this is more @joaomoreno's area, but powershell isn't built into older versions of Windows like 7 is it? |
|
@Tyriar just looked this up and looks like it's vista backwards that doesn't support powershell out of the box - https://en.wikipedia.org/wiki/Windows_PowerShell#PowerShell_2.0 |
| private spawnTerminal(spawner, configuration, path: string, onExit, onError) { | ||
| let terminalConfig = configuration.terminal; | ||
| let exec = terminalConfig.linux.exec || defaultLinuxTerm; | ||
| const child = spawner.spawn(exec, [], { cwd: path }); |
There was a problem hiding this comment.
Does just setting the cwd work with gnome-terminal? You may need to pass in --working-directory=path for that?
There was a problem hiding this comment.
node runs gnome-terminal at cwd specified in the options. I tested on Fedora 23 and it does go to the cwd specified. I think it's just a useful flag when someone wants to run from a different path other than the cwd gnome-terminal was executed from.
|
Currently OOF, will check this next week. |
A standard Fedora install comes with 2 multiple line environment variables. Since `env` was previously split by '\n' this would break them, causing errors in the output pane and in terminals launched through the file explorer (see #3495). The original commit didn't work on OSX since `env` does not support the --null arg. This version can fail if a command line arg's 1+th line looks like an environment variable. There is no easy way to prevent this since `process.env` cannot be leveraged. Since the likelyhood of this happening is small, plus the chance of it causing any significant issue is also small it's a reasonable compromise for the time being. Fixes #3928 Fixes #4672
|
Ping @joaomoreno |
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
| import fs = require('fs'); | ||
| import env = require('vs/base/common/platform'); |
There was a problem hiding this comment.
env -> platform, I think the instances where this is env are older ones that weren't cleaned up
| } | ||
|
|
||
| export const defaultWindowsTerm = 'cmd'; No newline at end of file | ||
| export const DEFAILT_WINDOWS_TERM = 'cmd'; No newline at end of file |
| @@ -0,0 +1,129 @@ | |||
| /*--------------------------------------------------------------------------------------------- | |||
There was a problem hiding this comment.
This should also live in electron-browser/.
|
I think this is good to go other than moving the test to |
|
Love it 😃 Thanks @pflannery! 🎆 |
|
thanks! |
|
I'm just getting to use this today. Thanks @pflannery I love it. |
This allows windows and linux users to specify which terminal they would like to launch when using the browser context menu -> "Open in Command Prompt".
Falls back to the default terminal if no settings specified.
New setting examples:
Ensures any spawn error is sent to the errors.onUnexpectedError event.
relates to #597