Skip to content

Commit

Permalink
Remove unneeded catch/throw from 'mkdir' and 'oss' functions (PowerSh…
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw authored Dec 10, 2018
1 parent b7b386d commit 2a12fb5
Showing 1 changed file with 16 additions and 49 deletions.
65 changes: 16 additions & 49 deletions src/System.Management.Automation/engine/InitialSessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4186,36 +4186,18 @@ .FORWARDHELPCATEGORY Cmdlet
)
begin {
try {
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('New-Item', [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd -Type Directory @PSBoundParameters }
$steppablePipeline = $scriptCmd.GetSteppablePipeline()
$steppablePipeline.Begin($PSCmdlet)
} catch {
throw
}
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('New-Item', [System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd -Type Directory @PSBoundParameters }
$steppablePipeline = $scriptCmd.GetSteppablePipeline()
$steppablePipeline.Begin($PSCmdlet)
}
process {
try {
$steppablePipeline.Process($_)
} catch {
throw
}
$steppablePipeline.Process($_)
}
end {
try {
$steppablePipeline.End()
} catch {
throw
}
$steppablePipeline.End()
}
";
Expand All @@ -4234,35 +4216,20 @@ internal static string GetOSTFunctionText()
[psobject]
${InputObject})
begin
{
try {
$PSBoundParameters['Stream'] = $true
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Out-String',[System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters }
$steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
$steppablePipeline.Begin($PSCmdlet)
} catch {
throw
}
begin {
$PSBoundParameters['Stream'] = $true
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Out-String',[System.Management.Automation.CommandTypes]::Cmdlet)
$scriptCmd = {& $wrappedCmd @PSBoundParameters }
$steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
$steppablePipeline.Begin($PSCmdlet)
}
process
{
try {
$steppablePipeline.Process($_)
} catch {
throw
}
process {
$steppablePipeline.Process($_)
}
end
{
try {
$steppablePipeline.End()
} catch {
throw
}
end {
$steppablePipeline.End()
}
<#
.ForwardHelpTargetName Out-String
Expand Down

0 comments on commit 2a12fb5

Please sign in to comment.