Skip to content

Atom values obtained from Write-Output are incorrectly encoded #157

Closed
@SpecterShell

Description

@SpecterShell

ConvertTo-Yaml is broken in the latest version (v0.4.8) when serializing a hashtable with atom values obtained from Write-Output. It is critical as values may be obtained from the functions that use Write-Output rather than return to return values.

For example, when assigning with Write-Output:

[ordered]@{a = Write-Output 'string'; b = Write-Output 1; c = Write-Output @{nested = $true}} | ConvertTo-Yaml
a:
  Length: 6
b: {}
c:
  nested: true

the string and the number were incorrectly encoded.

while without Write-Output:

[ordered]@{a = 'string'; b = 1; c = @{nested = $true}} | ConvertTo-Yaml
a: string
b: 1
c:
  nested: true

the values were correctly encoded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions