Skip to content

Fix I/O redirection with jobs #3130

@BrucePay

Description

@BrucePay

Steps to Reproduce

Redirecting streams to a file should work. In particular, redirection of the output of a job should work. The following should redirect the job output into files:

# start a job that produces output on the verbose and error streams
start-job { write-verbose -verbose "VERBOSE" ; write-information -InformationAction continue INFO }
# try to capture that output into files
receive-job 25 4> c:\temp\verbose.txt 6> c:\temp\info.txt

Expected behavior

There should be two txt files containing the words VERBOSE and INFO

Actual behavior

The files are created but are zero-length and the verbose and information outputs are written to stdout.

Environment data

PS > $PSVersionTable

Name                           Value
----                           -----
SerializationVersion           1.1.0.1
PSVersion                      6.0.0-alpha
BuildVersion                   3.0.0.0
WSManStackVersion              3.0
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
GitCommitId                    v6.0.0-alpha.9-804-g7ba3b50d4a1bbaad2c2f1047df625bcf8e712edc-dirty
PSRemotingProtocolVersion      2.3
CLRVersion
PSEdition                      Core

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions