Skip to content

Commit

Permalink
Changed usage of registry to psdrive instead of type which causes fai…
Browse files Browse the repository at this point in the history
…lure on Linux (PowerShell#3377)
  • Loading branch information
SteveL-MSFT authored and daxian-dbw committed Mar 21, 2017
1 parent 0e12fbf commit d59a71f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/powershell/engine/Help/HelpSystem.OnlineHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,23 @@ Describe 'Get-Help -Online opens the default web browser and navigates to the cm
if((-not ($skipTest)) -and $IsWindows)
{
$skipTest = $true
$regKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"
$regKey = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"

try
{
$progId = [Microsoft.Win32.Registry]::GetValue($regKey, "ProgId", $null)
$progId = (Get-ItemProperty $regKey).ProgId
if($progId)
{
$browserKey = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey("$progId\shell\open\command", $false)
if($browserKey)
if ((Get-PSDrive -Name HKCR) -eq $Null)
{
$browserExe = ($browserKey.GetValue($null) -replace '"', '') -split " "

if ($browserExe.count -ge 1)
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR | Should NotBeNullOrEmpty
}
$browserExe = ((Get-ItemProperty "HKCR:\$progId\shell\open\command")."(default)" -replace '"', '') -split " "
if ($browserExe.count -ge 1)
{
if($browserExe[0] -match '.exe')
{
if($browserExe[0] -match '.exe')
{
$skipTest = $false
}
$skipTest = $false
}
}
}
Expand Down

0 comments on commit d59a71f

Please sign in to comment.