Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Open in Powershell" option opens PowerShell in classic mode #10002

Open
Halofreak1990 opened this issue Jun 14, 2020 · 5 comments
Open

"Open in Powershell" option opens PowerShell in classic mode #10002

Halofreak1990 opened this issue Jun 14, 2020 · 5 comments
Labels
integrations Issues related to editor and shell integrations that ship in Desktop

Comments

@Halofreak1990
Copy link

A clear and concise description of what the feature or problem is.

As of a recent update to GitHub Desktop, the "Open in Powershell" option opens PowerShell in classic mode, whereas previously, it opened in the native PowerShell mode. Classic mode behaves like CMD, with mouse input by default restricted to context actions, instead of the rich experience PowerShell's native mode offers. This means a loss of options, like quick select and paste, unless explicitly enabled, and if the standard Windows handling of CMD is any indication, this means having to change this setting on a per-window basis.

Proposed solution

Revert the "Open in Powershell" option to the previous iteration, to allow users the rich experience they were used to before the change.

@tierninho tierninho added the more-info-needed The submitter needs to provide more information about the issue label Jun 16, 2020
@tierninho
Copy link
Contributor

@Halofreak1990 Thank for filing this. Please provide some more details:

  • What version of Desktop are you using (see help menu > About)? What version of Windows?
  • If you go to File > Options > Integrations > what shell is selected? Is there more than one PowerShell?
  • Can you share your logs? See the Help menu in Desktop.

Also, is PowerShell classic a setting within PowerShell or a different app altogether? Any idea how you can activate it? I am not familiar with Classic mode.

@Halofreak1990
Copy link
Author

@tierninho, I'm using Version 2.5.2. I also only have one item in the dropdown.

Upon further investigation, the problem seems to stem from the way PowerShell is invoked by GitHub desktop: If I launch PowerShell with the same command that Desktop uses through CMD.exe I get the current behavior, whereas starting powershell from C#'s Process.Start(), Windows Run (or the search bar), PowerShell launches as it did before.

@tierninho
Copy link
Contributor

As far as I'm aware the code for opening a shell for this hasn't been modified. Hopefully one of our developers can shed some light.

At this point, if you are able to share your logs, they would be helpful.

@niik niik added integrations Issues related to editor and shell integrations that ship in Desktop and removed more-info-needed The submitter needs to provide more information about the issue labels Oct 20, 2020
@niik
Copy link
Member

niik commented Oct 20, 2020

Hey @Halofreak1990, thanks for opening this! I'm afraid I don't know much about PowerShell classic and the new PowerShell but we currently have two supported shells in the app, PowerShell and PowerShell Core. The code which locates the executable for either of those are

async function findPowerShell(): Promise<string | null> {
const powerShell = enumerateValues(
HKEY.HKEY_LOCAL_MACHINE,
'Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\PowerShell.exe'
)
if (powerShell.length === 0) {
return null
}
const first = powerShell[0]
// NOTE:
// on Windows 7 these are both REG_SZ, which technically isn't supposed
// to contain unexpanded references to environment variables. But given
// it's also %SystemRoot% and we do the expanding here I think this is
// a fine workaround to do to support the maximum number of setups.
if (
first.type === RegistryValueType.REG_EXPAND_SZ ||
first.type === RegistryValueType.REG_SZ
) {
const path = first.data.replace(
/^%SystemRoot%/i,
process.env.SystemRoot || 'C:\\Windows'
)
if (await pathExists(path)) {
return path
} else {
log.debug(
`[PowerShell] registry entry found but does not exist at '${path}'`
)
}
}
return null
}

async function findPowerShellCore(): Promise<string | null> {
const powerShellCore = enumerateValues(
HKEY.HKEY_LOCAL_MACHINE,
'Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe'
)
if (powerShellCore.length === 0) {
return null
}
const first = powerShellCore[0]
if (first.type === RegistryValueType.REG_SZ) {
const path = first.data
if (await pathExists(path)) {
return path
} else {
log.debug(
`[PowerShellCore] registry entry found but does not exist at '${path}'`
)
}
}
return null
}

If you'd be interested in adding support for this new powershell there's documentation available at https://github.com/desktop/desktop/blob/03c154c463552a338a1eacceb1dd72abfeb42928/docs/technical/shell-integration.md.

I hope that is helpful!

@curtcurt871
Copy link

A clear and concise description of what the feature or problem is.

As of a recent update to GitHub Desktop, the "Open in Powershell" option opens PowerShell in classic mode, whereas previously, it opened in the native PowerShell mode. Classic mode behaves like CMD, with mouse input by default restricted to context actions, instead of the rich experience PowerShell's native mode offers. This means a loss of options, like quick select and paste, unless explicitly enabled, and if the standard Windows handling of CMD is any indication, this means having to change this setting on a per-window basis.

Proposed solution

Revert the "Open in Powershell" option to the previous iteration, to allow users the rich experience they were used to before the change.

#10002 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations Issues related to editor and shell integrations that ship in Desktop
Projects
None yet
Development

No branches or pull requests

4 participants