Skip to content

fix: make persistent_local_browser work on Windows#60

Open
rahulrao85 wants to merge 1 commit into
microsoft:mainfrom
rahulrao85:fix-windows-compat-persistent-browser
Open

fix: make persistent_local_browser work on Windows#60
rahulrao85 wants to merge 1 commit into
microsoft:mainfrom
rahulrao85:fix-windows-compat-persistent-browser

Conversation

@rahulrao85

Copy link
Copy Markdown

Summary

\persistent_local_browser.py\ uses POSIX-only APIs (\signal.SIGTERM, \start_new_session) which crash on Windows. This fix adds Windows code paths using \subprocess.CREATE_NEW_PROCESS_GROUP\ for process detachment and \ askkill\ for process termination.

Changes

  • _cmd_create(): Added \creationflags=subprocess.CREATE_NEW_PROCESS_GROUP\ on Windows to detach the browser subprocess from the parent
  • _terminate_pid(): Added Windows code path using \ askkill /F /T /PID\ before falling through to the POSIX-only \os.kill\ logic

Fixes: #58

Two Windows incompatibilities fixed:

1. Process detach: use subprocess.CREATE_NEW_PROCESS_GROUP on Windows instead of start_new_session (POSIX-only)

2. Process termination: use taskkill /F /T /PID on Windows instead of os.kill with SIGTERM/SIGKILL (Unix-only)

Fixes: microsoft#58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

persistent_local_browser broken on Windows: signal.SIGTERM and start_new_session are POSIX-only

1 participant