question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Tee-Object` should have a `-Console` parameter

See original GitHub issue

Summary of the new feature / enhancement

From the PowerShell for every system! idea, Tee-Object shouldn’t need a system specific value expression to output to a console (and the pipeline) but simply tee the object to both the success stream and the information stream.

<Strike>
Get-Content data.txt | Tee-Object ($IsWindows ? '\\.\CON': '/dev/tty')  | data_processor.exe
</strike>

Proposed technical implementation details (optional)

Wishful thinking: (see: Can you redirect Tee-Object to standard out?)

Get-Content data.txt | Tee-Object -Console | data_processor.exe

Issue Analytics

  • State:open
  • Created 3 months ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
TobiasPSPcommented, Jul 19, 2023

The cmdlet working group reviewed this and finds it a valuable addition. We believe it’s appropriate to call the parameter -Host because there are other hosts beside the console, i.e. VSCode.

2reactions
ThomasNietocommented, Jun 20, 2023

The parameter should be called Host since there could be a custom PS host that isn’t a console and also matches Out-Host writing to the Information stream.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tee-Object (Microsoft.PowerShell.Utility)
Tee -Object prints the piped results to the console using the FileName parameter. Where-Object filters the files by getting their content as a...
Read more >
Tee-Object: The Most Underused Cmdlet in PowerShell
The Tee-Object cmdlet has a FilePath parameter we can use to save the output to a file. Here's what this same task would...
Read more >
PowerShell console output from Tee-Object command ...
As the output stream has been stored into a variable, it won't go further up in the function call chain, so it won't...
Read more >
Tee-Object - PowerShell
Syntax Tee-Object [-inputObject psobject] [-filePath] string [-Append] [CommonParameters] ... This parameter was introduced in Windows PowerShell 3.0.
Read more >
Tee-Object: The Most Underused Cmdlet in PowerShell
The cmdlet “Tee-Object” in PowerShell sends or stores the output in two ways. One in the output variable or file and another in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found