question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ctrl+c does not kill the process

See original GitHub issue

Do you want to request a feature or report a bug? Bug

What is the current behavior? If you use puppeteer in your tests like here https://github.com/xfumihiro/jest-puppeteer-example and hit ctrl+c while tests are running the script will continue to run and it actually won’t quit by itself at that point. You need to kill it.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test. get https://github.com/xfumihiro/jest-puppeteer-example yarn test wait 2 or 3 seconds and ctrl+c

What is the expected behavior? ctrl+c should stop tests and terminate the process

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system. macOS 10.13.3 (17D102) node v8.1.2 yarn 1.1.0 tested with jest 22.0.0 and 22.4.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ranyitzcommented, Apr 22, 2018

I’ve cloned the provided repo, here is some additional information:

  1. When running npm test: ctrl+c works (npm takes care of terminating the process).
  2. When running yarn test: ctrl+c does seems to print the tests again and act weirdly like in @rickhanlonii gif.
  3. When running jest: ctrl+c seems to stop the tests, continue the timer and a second ctrl+c is terminating it. (gif added)

running-jest-bug

Seems that it might be good to handle SIGINT in jest to verify termination.

@sjuchno @mgolawski jest does not exit the process on ctrl+c because puppeteer launcher is catching the SIGINT here in order to kill chrome. If you’ll try the handleSIGINT option on the setup.js script

const browser = await puppeteer.launch({handleSIGINT: false})

The tests will terminate after ctrl+c but you’ll be left with an open chromium instance.

I’ve opened a PR to puppeteer https://github.com/GoogleChrome/puppeteer/pull/2428 which should solve the issue and exit the process after killing the chrome instance.

Regardless of this case, we can still handle SIGINT in jest, which might also solve the bug from jest side for this and future use cases.

0reactions
github-actions[bot]commented, Apr 27, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do when Ctrl + C can't kill a process? - Super User
Ctrl + C doesn't always work to kill the current process (for instance, if that process is busy in certain network operations).
Read more >
How To Kill A Process That Won't Respond To ctrl-C
This information tells you that the process has now become a stopped job and the number in square brackets is its job number....
Read more >
Ctrl-C doesn't kill process in command prompt when ... - GitHub
Steps to Reproduce: From Windows, use Ctrl-Shift-C to trigger "Open New Command Prompt" which should launch a cmd.exe window.
Read more >
Ctrl+C doesn't work in cmd.exe - Microsoft Community
I can kill a process the way Ctrl+C does, by pressing Ctrl+Fn+S. I don't get to see "^C" appearing, but any process is...
Read more >
CTRL + C in Visual Studio terminal does nothing 50% of the ...
This is neither a bug nor a feature of VS Code; VS Code is merely providing an interface for the computer's command line...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found