开发者

Difference between Cmdlet.EndProcessing and Cmdlet.StopProcessing

开发者 https://www.devze.com 2022-12-10 00:39 出处:网络
When writing Powershell cmdlets, what is th开发者_开发百科e difference between EndProcessing and StopProcessing? They sound the same, their descriptions are just about the same, and latter doesn\'t ap

When writing Powershell cmdlets, what is th开发者_开发百科e difference between EndProcessing and StopProcessing? They sound the same, their descriptions are just about the same, and latter doesn't appear in the cmdlet lifecycle documentation.


StopProcessing is called if the execution of the CmdLet is cancelled (pressing CNTRL-C will cause StopProcessing to be executed).

EndProcessing is called if the execution of the CmdLet ends normally.

I typically use StopProcessing and EndProcessing to do the same thing... that is to clean up resources that were provisioned during BeginProcessing or ProcessRecord, in some cases though there is some difference between what actions each provides.

It seems like a mistake that it is not shown in the life cycle documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消