我正在尝试在 powershell 中使用 cleartool 命令。
如果命令失败,它应该捕获异常并执行操作。但它没有被 catch {} 捕获
try {
#If $viewname not exist it will throw error
cleartool lsview $ViewName
}
catch {
# If list view fails , it means View doesn't exist. So create view
Write-host "Create view"
cleartool mkview -tag $ViewName -nsh $ccViews$ViewName".vws"
}
当 try 中的命令失败时,它不会调用 catch 中的表达式。
catch 命令是否不适用于非 .net 相关的东西?