mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add more information to job process failure error (#7251)
This commit is contained in:
+26
-2
@@ -708,8 +708,32 @@ namespace System.Management.Automation.Remoting.Client
|
||||
//
|
||||
stdInWriter.StopWriting();
|
||||
}
|
||||
PSRemotingTransportException psrte = new PSRemotingTransportException(PSRemotingErrorId.IPCServerProcessExited,
|
||||
RemotingErrorIdStrings.IPCServerProcessExited);
|
||||
|
||||
// Try to get details about why the process exited
|
||||
// and if they're not available, give information as to why
|
||||
string processDiagnosticMessage;
|
||||
try
|
||||
{
|
||||
var jobProcess = (Process)sender;
|
||||
processDiagnosticMessage = StringUtil.Format(
|
||||
RemotingErrorIdStrings.ProcessExitInfo,
|
||||
jobProcess.ExitCode,
|
||||
jobProcess.StandardOutput.ReadToEnd(),
|
||||
jobProcess.StandardError.ReadToEnd());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
processDiagnosticMessage = StringUtil.Format(
|
||||
RemotingErrorIdStrings.ProcessInfoNotRecoverable,
|
||||
exception.Message);
|
||||
}
|
||||
|
||||
string exitErrorMsg = StringUtil.Format(
|
||||
RemotingErrorIdStrings.IPCServerProcessExited,
|
||||
processDiagnosticMessage);
|
||||
var psrte = new PSRemotingTransportException(
|
||||
PSRemotingErrorId.IPCServerProcessExited,
|
||||
exitErrorMsg);
|
||||
RaiseErrorHandler(new TransportErrorOccuredEventArgs(psrte, transportMethod));
|
||||
}
|
||||
|
||||
|
||||
@@ -794,7 +794,7 @@ Do you want to continue?</value>
|
||||
<value>The background process reported an error with the following message: {0}.</value>
|
||||
</data>
|
||||
<data name="IPCServerProcessExited" xml:space="preserve">
|
||||
<value>The background process closed or ended abnormally.</value>
|
||||
<value>The background process closed or ended abnormally: {0}.</value>
|
||||
</data>
|
||||
<data name="IPCErrorProcessingServerData" xml:space="preserve">
|
||||
<value>There is an error processing data from the background process. Error reported: {0}.</value>
|
||||
@@ -1657,4 +1657,14 @@ All WinRM sessions connected to PowerShell session configurations, such as Micro
|
||||
<data name="WSManClientDllNotAvailable" xml:space="preserve">
|
||||
<value>This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.</value>
|
||||
</data>
|
||||
<data name="ProcessExitInfo" xml:space="preserve">
|
||||
<value>
|
||||
Exit code: {0}
|
||||
Stdout: '{1}'
|
||||
Stderr: '{2}'
|
||||
</value>
|
||||
</data>
|
||||
<data name="ProcessInfoNotRecoverable" xml:space="preserve">
|
||||
<value>Information about the process could not be read: '{0}'.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user