gemini-gui
gemini-gui copied to clipboard
Ctrl-C doesn't terminate gemini-gui server when running through npm run
Steps
npm install --save-dev gemini-gui- configure gemini to use chromedriver
- add npm run
test:guicommand topackage.json:
{
// ...
"scripts": {
"test:gui": "gemini-gui -p 8076 ./gemini",
}
}
- launch gemini-gui through
npm run test:gui - click
Runbutton to run tests - hit Ctrl-C in the server console
Expected
gemini-gui server is terminated
Actual
npm run script is terminated, but gemini-gui is still running and occupies the port forever
Logs
$ grep test:gui package.json
"test:gui": "gemini-gui -p 8076 ./gemini",
$ npm run test:gui
> [email protected] test:gui /Users/user/src/somepkg
> gemini-gui -p 8076 ./gemini
GUI is running at http://localhost:8076
✓ somepkg home [chrome]
Total: 1 Passed: 1 Failed: 0 Skipped: 0 Retries: 0
^CCancelling...
$ npm run test:gui
> [email protected] test:gui /Users/user/src/somepkg
> gemini-gui -p 8076 ./gemini
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 127.0.0.1:8076
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at Server._listen2 (net.js:1259:14)
at listen (net.js:1295:10)
at net.js:1405:9
at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)
Address is indeed still in use:
$ lsof -PiTCP -sTCP:LISTEN | grep 8076
node 85382 user 15u IPv4 0xdeadbeef12345 0t0 TCP localhost:8076 (LISTEN)
Curiously, it prints Force quit when killing the process:
$ kill 85382
Force quit.
(The problem is even more confusing because of #2)
Thanks for filing this ticket. I'm seeing this same issue:
$ gemini-gui .
# The user must now run tests in the GUI or the bug won't surface.
# ...test output...
# ...test output...
# ...test output...
^CCancelling...
At this point, the command hangs forever or until ctrl-c is pressed again. However, when executed through NPM, the issue is even more confusing and problematic:
...,
"scripts": {
...,
"test:gemini-gui": "gemini-gui ."
...
},
...
$ npm run -s test:gemini-gui
# The user must now run tests in the GUI or the bug won't surface.
# ...test output...
# ...test output...
# ...test output...
^CCancelling...
Unlike when executed directly, the NPM command appears to terminate after "Cancelling..." but Gemini GUI is actually still running in the background because it ignores the initial SIGINT. This causes the port to stay open. The issue appears to be in Gemini itself, not the GUI.