Skip to content

Conversation

rjmholt
Copy link
Collaborator

@rjmholt rjmholt commented Jul 9, 2018

PR Summary

Adds more information to the exception thrown when the process running a job exits unexpectedly. This is part of an attempt to work out why a particular Stop-Job test is failing in CI. See #7249.

We can change the particular implementation and error message as needed. Even if we decide not to merge it, opening the PR may still help us to diagnose the problem.

PR Checklist

catch (Exception exception)
{
exitCode = -1;
exitMessage = StringUtil.Format("<Unable to read streams from job process for reason '{0}'>", exception.Message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message string should also go into the resx file for eventual localization.

{
var jobProcess = (Process)sender;
exitCode = jobProcess.ExitCode;
exitMessage = exitCode == 0 ? jobProcess.StandardOutput.ReadToEnd() : jobProcess.StandardError.ReadToEnd();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for both stdout and stderror to have information on exit? We may want to read both, but I think this is fine for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking the same - wasn't sure what the policy is on cramming too much information into a single error message

<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>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split on three line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that would be nicer. Is that "allowed" in error messages?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have multiline error messages.

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iSazonov iSazonov changed the title [Feature] Add more information to job process failure error Add more information to job process failure error Jul 11, 2018
@iSazonov iSazonov closed this Jul 11, 2018
@iSazonov iSazonov reopened this Jul 11, 2018
@iSazonov
Copy link
Collaborator

Reopen the PR to restart CIs.

@iSazonov iSazonov merged commit 6a66a6e into PowerShell:master Jul 12, 2018
@iSazonov iSazonov self-assigned this Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants