Skip to content

Windows: spawned Node.js processes create visible console windows (fix: windowsHide: true) #459

Description

@jmadore-payfacto

Summary

On Windows, every spawned sub-process (watcher, Claude CLI child, zeroshot task run) creates a visible cmd.exe or Node.js console window that appears on the user's desktop and taskbar. These windows flash or persist while agents are running, making the tool unusable in a desktop environment.

Root cause

Node.js spawn() and fork() on Windows default to creating a new console window for each child process. This can be suppressed by passing windowsHide: true in the spawn options — but none of the four spawn/fork call sites in zeroshot do this.

Affected files and call sites

File Function Type
task-lib/runner.js spawnWatcher() fork()
task-lib/watcher.js main child spawn spawn()
src/agent/agent-task-executor.js spawnTaskProcess() spawn()
src/claude-task-runner.js _spawnAndGetTaskId() spawn()

Fix

Add windowsHide: true to the options object in each of the four call sites above.

task-lib/runner.jsspawnWatcher():

const watcher = fork(
  watcherScript,
  [id, cwd, logFile, JSON.stringify(finalArgs), JSON.stringify(watcherConfig)],
  {
    detached: true,
    stdio: 'ignore',
    windowsHide: true,  // add this
  }
);

task-lib/watcher.js — main child spawn:

const child = spawn(spawnCmd, spawnFinalArgs, {
  cwd,
  env,
  stdio: ['ignore', 'pipe', 'pipe'],
  windowsHide: true,  // add this
});

src/agent/agent-task-executor.jsspawnTaskProcess():

const proc = spawn(spawnCmd, spawnArgs, {
  cwd,
  stdio: ['ignore', 'pipe', 'pipe'],
  env: spawnEnv,
  windowsHide: true,  // add this
});

src/claude-task-runner.js_spawnAndGetTaskId():

const proc = spawn(spawnCmd, spawnArgs, {
  cwd,
  stdio: ['ignore', 'pipe', 'pipe'],
  env: spawnEnv,
  windowsHide: true,  // add this
});

Environment

  • Windows 11 Pro 10.0.26200
  • Node.js (npm global install)
  • @covibes/zeroshot latest

Additional context

This is part of a broader set of Windows compatibility issues. Related: #457 (spawn ENOENT on Windows for npm global commands).

windowsHide is a no-op on non-Windows platforms, so this change is safe to apply unconditionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions