Skip to content

SIGINT (Ctrl+C) and SIGTERM are not handled #189

Open

Description

@aalexgabi

When executing this file with c8 I get the coverage information.

function run() {
  if (1) {
    console.log(1);
  } else {
    console.log(2);
  }
}

run();

setTimeout(process.exit, 3000)

However if I kill the process using Ctrl+C before the timeout, I don't get the coverage information for the code executed until that point.

Use case: I launch a service as a separate process and then launch integration tests (by sending requests to the service). Then I kill the service and check the coverage to make the tests pass. istanbul and nyc handle process kill correctly.

Activity

  1. bcoe commented on Jan 13, 2020

    @bcoe
    Owner

    @aalexgabi what Node.js version are you running on, out of curiosity? We have unit tests for CTRL^C in Node.js I believe, so this might be specific to c8.

  2. zbjornson commented on Jan 14, 2020

    @zbjornson

    This I believe is half the problem in #166. (I'm using Node.js v12.10.0 and Win10 x64.)

  3. aalexgabi commented on Jan 14, 2020

    @aalexgabi
    Author

    @aalexgabi what Node.js version are you running on, out of curiosity? We have unit tests for CTRL^C in Node.js I believe, so this might be specific to c8.

    @bcoe I'm using node v13.5.0.

  4. aalexgabi commented on Jan 14, 2020

    @aalexgabi
    Author

    @bcoe @zbjornson Seems to be a node problem:

    % NODE_V8_COVERAGE=/tmp/cov node /tmp/t.js
    1
    ^C
    % ls /tmp/cov
    % 
  5. aalexgabi commented on Sep 15, 2020

    @aalexgabi
    Author

    I created an issue for node: nodejs/node#35212

    Should c8 attach an event handler for SIGINT/SIGTERM etc. in the meantime ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions