Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Direct redirection of a custom object ([pscustomobject] instance) to a file with ">" produces no output. #4812

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Even though > is not an actual alias of Out-File, it usually is an effective alias; the two generally behave the same.

However, when outputting a [pscustomobject] instance, > apparently produces an empty file (the file contains only the UTF16-LE BOM and a newline):

Steps to reproduce

# Use Out-File explicitly.
[pscustomobject] @{ one = 1 } | Out-File tmp.txt; Get-Content tmp.txt

'---'

# Use > instead of Out-File, which should produce the same result.
[pscustomobject] @{ one = 1 } > tmp.txt; Get-Content tmp.txt

Expected behavior


one
---
  1

---

one
---
  1

Actual behavior


one
---
  1

---

I.e., using > instead of Out-File resulted in an empty file (just the UTF16-LE BOM and a newline).

Environment data

PowerShell Core v6.0.0-beta.6 on macOS 10.12.6
PowerShell Core v6.0.0-beta.6 on Ubuntu 16.04.3 LTS
PowerShell Core v6.0.0-beta.6 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.502 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Languageparser, language semanticsparser, language semantics

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.