Skip to content
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

Fix service crashes #643

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Fix service crashes #643

merged 1 commit into from
Aug 10, 2020

Conversation

nxtn
Copy link
Contributor

@nxtn nxtn commented Aug 10, 2020

Codes

Log.Debug("Sending Ctrl+C...");

if (!SetConsoleCtrlHandler(null, true))
    throw new Win32Exception();

if (!GenerateConsoleCtrlEvent(CtrlEvents.CTRL_C_EVENT, 0))
    throw new Win32Exception();

if (!SetConsoleCtrlHandler(null, false))
    throw new Win32Exception();

bool succeeded = FreeConsole();
Debug.Assert(succeeded);

Log.Debug("Sent Ctrl+C.");

Test codes

Assert.EndsWith(
    ServiceMessages.StoppedSuccessfully + Environment.NewLine,
    File.ReadAllText(Path.ChangeExtension(config.FullPath, ".wrapper.log")));

Test output

  Error Message:
   Assert.EndsWith() Failure:
Expected:    Service stopped successfully.

Actual:   ···430 DEBUG - Sending Ctrl+C...

@nxtn nxtn added the tests label Aug 10, 2020
@nxtn nxtn added this to the 3.x milestone Aug 10, 2020
@nxtn nxtn requested a review from oleg-nenashev as a code owner August 10, 2020 02:20
@nxtn nxtn added bug and removed tests labels Aug 10, 2020
@nxtn nxtn changed the title [TEST] Guard against service crashes Fix service crashes Aug 10, 2020
@nxtn nxtn merged commit 1f188cf into winsw:v3 Aug 10, 2020
@nxtn nxtn deleted the v3-crash branch August 10, 2020 06:32
@nxtn nxtn mentioned this pull request Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stopping of java process: logfile issue, status issue service cannot stop
1 participant