PowerShell / PowerShell/vscode-powershell

Built-in `help` function writes Unicode BOM () to host

Abierto
#1,104 16 comentarios 4 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Area-Extension Terminal Issue-Bug
Lenguaje dominante
TypeScript
Estrellas
1.9k
Forks
548
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

System Details
  • Operating system name and version: Windows 10 Version 1709
  • VS Code version: 1.18.0
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.16299.64
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.64
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
  • VSCode plugin list:
C:\> code --list-extensions --show-versions
bradygaster.azuretoolsforvscode@1.3.0
CoenraadS.bracket-pair-colorizer@0.10.13
DotJoshJohnson.xml@1.9.2
eamodio.gitlens@6.1.0
EditorConfig.EditorConfig@0.11.1
johnpapa.azure-functions-tools@0.3.1
KnisterPeter.vscode-github@0.23.0
ms-mssql.mssql@1.2.1
ms-vscode.azure-account@0.2.2
ms-vscode.csharp@1.13.1
ms-vscode.PowerShell@1.5.1
msazurermtools.azurerm-vscode-tools@0.3.7
patrys.vscode-code-outline@0.0.12
PeterJausovec.vscode-docker@0.0.22
rebornix.Ruby@0.15.0
somekittens.hot-dog-stand@6.6.9
vscodevim.vim@0.10.4
zgudino.editorconfig-vscode-snippet@0.2.0
Issue Description

When I use the help function, a few garbage unicode characters are written to the output stream. Using Get-Help instead of help works as expected. This only happens in the extension-provided Powershell Integrated Console, not the default vscode console.

C:\> help get-date

NAME
    Get-Date
[...snip...]
C:\> help get-date -showwindow

C:\> help get-date > $null
(no output)
C:\> get-help get-date -showwindow
(no output)

On my system, the definition of the help function is:

C:\> Get-Command help | select -ExpandProperty Definition
<#
.FORWARDHELPTARGETNAME Get-Help
.FORWARDHELPCATEGORY Cmdlet 
#>
[CmdletBinding(DefaultParameterSetName='AllUsersView', HelpUri='https://go.microsoft.com/fwlink/?LinkID=113316')]
param(
    [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)]
    [string]
    ${Name},

    [string]
    ${Path},

    [ValidateSet('Alias','Cmdlet','Provider','General','FAQ','Glossary','HelpFile','ScriptCommand','Function','Filter','ExternalScript','All','DefaultHelp','Workflow','DscResource','Class','Configuration')]
    [string[]]
    ${Category},

    [string[]]
    ${Component},

    [string[]]
    ${Functionality},

    [string[]]
    ${Role},

    [Parameter(ParameterSetName='DetailedView', Mandatory=$true)]
    [switch]
    ${Detailed},

    [Parameter(ParameterSetName='AllUsersView')]
    [switch]
    ${Full},

    [Parameter(ParameterSetName='Examples', Mandatory=$true)]
    [switch]
    ${Examples},

    [Parameter(ParameterSetName='Parameters', Mandatory=$true)]
    [string]
    ${Parameter},

    [Parameter(ParameterSetName='Online', Mandatory=$true)]
    [switch]
    ${Online},

    [Parameter(ParameterSetName='ShowWindow', Mandatory=$true)]
    [switch]
    ${ShowWindow})

    #Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
    $outputEncoding=[System.Console]::OutputEncoding

    Get-Help @PSBoundParameters | more

... and more is defined as ...

C:\> Get-Command more | select -ExpandProperty Definition

param([string[]]$paths)
$OutputEncoding = [System.Console]::OutputEncoding
if($paths) {
    foreach ($file in $paths)
    {
        Get-Content $file | more.com
    }
} else { $input | more.com }
Attached Logs

1510862054-d0c22b7a-9fe8-4400-9e12-9cb2d4fd6b5a1510862041231.zip

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se nombra ningún archivo fuente ni ninguna prueba. Reproduce el problema en la PowerShell Integrated Console proporcionada por la extensión con help get-date y, después, compara Get-Help con la consola predeterminada de VS Code. Rastrea los puntos de entrada help y more y el comportamiento de la codificación de salida; se considera terminado cuando la BOM está ausente, mientras que la salida normal, -showwindow y la redirección siguen comportándose como se informó.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell, typescript, vscode
Área
cli, developer-experience, devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.