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 関連以外のものでは機能しないのでしょうか?