Repository navigation
Conversation
…essions gracefully create-wdio registered a SIGINT listener at module load. @wdio/cli imports create-wdio/config/cli, so on Ctrl+C every `wdio run` called process.exit(1) before the launcher's graceful shutdown could delete the WebDriver sessions, leaving them open on the grid or device until they timed out. The listener is now added only while the wizard prompts or installs (npm init wdio, the config questionnaire, the missing-config prompt and the Appium installer prompt) and removed afterwards, so it never reaches a test run. Regression from #14618. A new smoke suite, sigintGracefulShutdown, sends SIGINT to a running `wdio run` and checks the graceful shutdown path.
create-wdio
eslint-plugin-wdio
wdio
@wdio/ai-service
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/cucumberjs-json-reporter
@wdio/display-server
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/session
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/smoke-test-service
@wdio/snapshot
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
webdriver
webdriverio
commit: |
[Medium impact] The change affects Ctrl+C handling across WDIO setup and test runs. The fix appears safe to merge, with a non-blocking gap in the shutdown smoke test. Findings
SummaryRemoves the import-time
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Import create-wdio] --> B[No SIGINT listener added]
C[Start wizard work] --> D[Add scoped SIGINT listener]
D --> E[Prompt or install]
E --> F[Remove listener in finally]
F --> G[Return to CLI]
G --> H[Start test run]
H --> I[SIGINT reaches launcher shutdown]
Reviews (1) · Last reviewed commit: "fix(create-wdio): stop exiting on SIGINT..." · Reviewed by Greptile |
There was a problem hiding this comment.
The smoke test ignores the child's exit code and signal, then checks only output. The launcher prints Ending WebDriver sessions gracefully before calling runner.shutdown(). A run that hangs during shutdown can print that message, reach the 30-second SIGKILL, and still pass.
Record whether the watchdog fired and reject forced termination. Also check that the session was deleted, rather than relying only on the shutdown message.

Problem
create-wdioregistered a SIGINT listener at module load (packages/create-wdio/src/utils.ts).@wdio/cliimportscreate-wdio/config/cli, so on Ctrl+C everywdio runcalledprocess.exit(1)("Goodbye 👋") about 60 ms after the signal, before the launcher's graceful shutdown could delete the WebDriver sessions. Sessions stayed open on the grid or device until they timed out. This affects every framework and was introduced in #14618 (v10.0.0).Fix
The listener is now added only while the wizard prompts or installs, and removed in a
finallyafterwards (withSigintExit):npm init wdio--yes)It never reaches a test run.
Verification
npx vitest run packages/create-wdio packages/wdio-cli/tests/commands: 233/233. The newtests/sigint.test.tsfails on the old code.sigintGracefulShutdown(pnpm run test:smoke sigintGracefulShutdown) sends SIGINT to a runningwdio runand checks for "Ending WebDriver sessions gracefully". It fails with "Goodbye 👋" when the module-load listener is put back. It is skipped on Windows, wherechild.kill('SIGINT')is not a console Ctrl+C.