Skip to content

[Bug] Windows async ask mode fails silently — PowerShell subprocess exits immediately #167

@GengZzz

Description

@GengZzz

Bug: Windows async ask fails due to DETACHED_PROCESS flag

Environment

  • OS: Windows 11
  • Terminal: WezTerm
  • Shell: PowerShell

Description

On Windows, async ask <provider> "message" never completes — tasks stay in submitted/spawned state forever. --foreground mode works fine.

Root Cause

bin/ask uses DETACHED_PROCESS (0x00000008) in creationflags when spawning the PowerShell script. This causes PowerShell to exit immediately without executing the script because it has no console.

Fix

Remove DETACHED_PROCESS from creationflags. CREATE_NO_WINDOW is sufficient to hide the console window.

- creationflags=DETACHED_PROCESS | CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP,
+ creationflags=CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP,

Two locations in bin/ask need updating (~lines 663 and 725).

Verification

Tested with and without DETACHED_PROCESS:

  • With: PowerShell exits immediately, script never runs
  • Without: Script executes normally, async ask works end-to-end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions