WindowsサービスとしてNServiceBusサービスをインストールするためのpowershellスクリプトがあります。PowershellにNServicebusサービスをインストールするときにエラーが発生する
Invoke-Expression "$fullNsbHostPath $arguments"
は完全を期すために、私が試したの両方Invoke-Expression
とStart-Process
:
Start-Process -Wait -NoNewWindow -FilePath $fullNsbHostPath -ArgumentList $arguments -RedirectStandardOutput $tempFileName -ErrorVariable $errvar
これは、特定の状況下たとえば例外報告うまくインストーラ、アップ発射:
Failed to execute installers: System.Data.SqlClient.SqlException
(0x80131904): A connection was successfully established with the
server, but then an error occurred during the login process.
(provider: Shared Memory Provider, error: 0 - No process is on the
other end of the pipe.) ---> System.ComponentModel.Win32Exception
(0x80004005): No process is on the other end of the pipe ... Error
....
Number:233,State:0,Class:20
を
私はこれに満足しています。 I は例外であると予想します。ただし、プロセス自体は、失敗したことを示すものではありません。確かに、Powershellスクリプト自体は正常に完了します。
エラーコードまたは多少の「例外」テキストの出力テキストを解析することができましたが、これは残念ながら不満足なようです。
私はこれがPowershellの問題ではないと思います。私がコマンドラインで単に実行し、%errorlevel%
を調べると、0
が得られます。さらに、同じことをするいくつかの他のオンラインスクリプトの例では、エラー伝搬も省略されています。
提案がありますか?
NServiceBus.Host.exeには、すべての例外をキャッチしてコンソール(stderrではなくstdout)に書き出し、終了コードを設定しないコードが含まれているため、すべての出力を解析していないと、再詰まった。 –