feat: add scoped browser stop and job control

This commit is contained in:
QiuSW
2026-07-22 15:03:21 +08:00
parent d6f6bb0f2c
commit 1ce02bcf3b
8 changed files with 262 additions and 14 deletions
+24
View File
@@ -0,0 +1,24 @@
//go:build !windows
package browser
import (
"context"
"errors"
"os"
)
type jobHandle struct{}
func (jobHandle) assign(*os.Process) error { return nil }
func (jobHandle) close() {}
func (p *osProcess) Stop(ctx context.Context, force bool) error {
if err := ctx.Err(); err != nil {
return err
}
if !force {
return errors.New("graceful browser close is only supported on Windows")
}
return p.command.Process.Kill()
}