-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module
Description
if you invoke a script block which has write-error, you get the entire contents of the scriptblock in the write-error output. It would be better if it were only the write-error line, and the line of the scriptblock which had the error
Steps to reproduce
PS> $sb = [scriptblock]::Create("get-date
(get-location).path
write-error badthing")
PS> & $sb
Expected behavior
Friday, March 2, 2018 11:37:45 AM
/tmp
write-error badthing : badthing
At line:3 char:1
+ & $sb
+ ~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
Actual behavior
Friday, March 2, 2018 11:37:45 AM
/tmp
get-date
(get-location).path
write-error badthing : badthing
At line:1 char:1
+ & $sb
+ ~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException
note that the entire scriptblock contents has been emitted. This could be ridiculously large.
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1
OS Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X8...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
mklement0, bergmeister, mortenlerudjordet, dragonwolf83 and vexx32
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.The issue won't be fixed, possibly due to compatibility reason.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core modulecmdlets in the Microsoft.PowerShell.Core module