-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add exit call back to custom test host process #1358
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,15 +131,18 @@ public bool TryGetExitCode(object process, out int exitCode) | |
} | ||
|
||
/// <inheritdoc/> | ||
public void SetExitCallback(int processId, Action callbackAction) | ||
public void SetExitCallback(int processId, Action<object> callbackAction) | ||
{ | ||
var process = Process.GetProcessById(processId); | ||
|
||
process.EnableRaisingEvents = true; | ||
process.Exited += (sender, args) => | ||
try | ||
{ | ||
var process = Process.GetProcessById(processId); | ||
process.EnableRaisingEvents = true; | ||
process.Exited += (sender, args) => callbackAction.Invoke(process); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
if there's a process crash before the hookup.. call the handler.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In line 140, try |
||
} | ||
catch (ArgumentException) | ||
{ | ||
callbackAction.Invoke(); | ||
}; | ||
// Ignore the exception if process is not running. | ||
} | ||
} | ||
|
||
/// <inheritdoc/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicitly as Process or have an eventArgs..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Process API's are not available in UWP, using it explicitly here would mean we cannot built uwp platform abstraction.