Skip to content

Bug: Lifecycle scripts use child_process.spawn instead of PTY, breaking interactive tools #1304

@arnestrickmann

Description

@arnestrickmann

Bug Report

Description
Lifecycle scripts (setup/run/teardown) in TaskLifecycleService.ts use child_process.spawn with shell: true and piped stdout/stderr — no TTY. This means any tool that checks for an interactive terminal fails when run via lifecycle scripts, even though the exact same command works perfectly in the terminal tab right next to it.

Root Cause

The terminal tab uses node-pty which provides full TTY support. Lifecycle scripts use child_process.spawn which provides no TTY — programs see process.stdout.isTTY === false and either degrade or fail.

Affected Tools

Any dev tool that detects TTY and changes behavior:

Tool In terminal tab (PTY) In lifecycle script (spawn)
Turborepo TUI dashboard works Falls back to plain logs or crashes
Expo Interactive device menu Fails or skips interactivity
Vite / Next.js Colored output, key shortcuts Plain text, no interactivity
Docker Compose Colored, formatted output Raw unformatted logs

Steps to Reproduce

  1. Set a project's run script to something interactive (e.g., turbo dev)
  2. Start a task — lifecycle script runs the command
  3. The tool fails or degrades because it detects no TTY
  4. Run the same command manually in the terminal tab — works perfectly

Expected Behavior

Lifecycle scripts should run with full TTY support, matching the terminal tab behavior.

Suggested Fix

Run lifecycle scripts via node-pty (same as the terminal tab does) instead of child_process.spawn. At minimum, offer this as a configuration option so users can opt into PTY-backed lifecycle scripts when their tools require interactivity.

Affected Code

  • src/main/services/LifecycleScriptsService.ts — Currently uses child_process.spawn
  • Should leverage the same node-pty infrastructure used by src/main/services/ptyManager.ts

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