Skip to content

Conversation

@krichprollsch
Copy link
Member

In the docker container, the browser doesn't exit on CRTL-C (SIGINT).
Catching the signal and exiting fixes the issue.

Reproduce the issue

You can reproduce the issue with the existing version of the docker image

$ docker run -ti --rm --name lpd  lightpanda/browser:nightly

# the container starts the browser with the serve command.
# try CTRL-C: the container doesn't stop.
# use docker docker kill lpd to kill the container. 

src/main.zig Outdated
std.posix.sigaction(std.posix.SIG.INT, &std.posix.Sigaction{
.handler = .{
.handler = struct {
pub fn handler(_: c_int) callconv(.C) void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.c for Zig 0.15 compatibility.

.handler = .{
.handler = struct {
pub fn handler(_: c_int) callconv(.C) void {
std.posix.exit(0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's worth it, we can create a global ?App and ?Server, and try to shutdown them cleanly.

The one argument that I can make for going through the trouble is that, on deinit, the app flushes the telemetry queue. Can also do it in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, it would be nice, I can try that.

@karlseguin karlseguin merged commit 67b479b into main Aug 29, 2025
10 checks passed
@karlseguin karlseguin deleted the sigint branch August 29, 2025 02:10
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants