Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information Stream #129

Open
sheldonhull opened this issue Feb 22, 2017 · 3 comments
Open

Information Stream #129

sheldonhull opened this issue Feb 22, 2017 · 3 comments

Comments

@sheldonhull
Copy link

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
There does not seem to be a "information" stream for powershell 5.0 write-information functionality. I've tried migrating most of my work away from write-host and ensure write-information is used.

        public System.Management.Automation.PSDataCollection<System.Management.Automation.ErrorRecord> Error;
        public System.Management.Automation.PSDataCollection<System.Management.Automation.VerboseRecord> Verbose;
        public System.Management.Automation.PSDataCollection<System.Management.Automation.DebugRecord> Debug;
        public System.Management.Automation.PSDataCollection<System.Management.Automation.WarningRecord> Warning;
        public System.Management.Automation.PSDataCollection<System.Management.Automation.ProgressRecord> Progress;

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?
Wrap up "information" stream into an output stream for accessing and providing output.

@sheldonhull
Copy link
Author

Do you have a tip on where i would add the changes to implement InformationRecord here?
Thinking if this project is still planned on continued support of adding a few custom enhancements and submit them to project to contribute (like estimated time to completion based on custom powershell progress helper class I wrote), and getting information stream back out.

@JacobStruiksma
Copy link

The Innerjob of a RsJob is the underlying powershell object.
From there you can get information stream with: Streams.Information

$job =  $null | Start-RSJob -ScriptBlock {
    Write-Information -MessageData 'x'
}
$job |Wait-RSJob
$job.InnerJob.Streams.Information

I was also wondering about the information stream not being directly available from rsjob. Didn't know it is a Powershell 5.0 feature.

If you want to add it with RsJob you need to change the following file:
PoshRSJob/PoshRSJob/TypeData/PoshRSJob.Types.ps1xml

But i guess that would break backwards compatibility with powershell versions before 5.0

@sheldonhull
Copy link
Author

Thanks for this useful update. I started using PSFramework and it solves all my logging woes and is backward compatible, thread safe, and more. If I need to log streams now I just that as it works with various scopes that were a problem in figuring out with nested jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants