Skip to content

v7.1.8 cannot be run as a spawned process while ignoring stdin #20884

@kentcdodds

Description

@kentcdodds

Describe the bug

Here's a video demo: https://www.loom.com/share/4979d2d7a3764944a954b9632c694bda

Basically, doing this causes vite to immediately exit as of v7.1.8:

import { spawn } from 'child_process';

const process = spawn('npx', ['vite'], {
	stdio: ['ignore', 'inherit', 'inherit'],
});

process.on('exit', (code, signal) => {
	console.log(`Process exited with code ${code} and signal ${signal}`);
});

My reproduction is a new vanilla vite project created today.

Reproduction

https://github.com/kentcdodds/spawn-vite

Steps to reproduce

git clone https://github.com/kentcdodds/spawn-vite.git
cd ./spawn-vite
npm install
node ./spawn.js

Notice it exits immediately. Then

npm i [email protected] --save-exact && node spawn.js

And it runs as expected

System Info

System:
    OS: macOS 15.6.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 23.40 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.1 - ~/n/bin/node
    Yarn: 1.22.22 - ~/n/bin/yarn
    npm: 11.4.2 - ~/n/bin/npm
    pnpm: 10.18.0 - ~/n/bin/pnpm
    bun: 1.2.18 - /opt/homebrew/bin/bun
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 140.1.82.173
    Chrome: 140.0.7339.214
    Safari: 18.6
  npmPackages:
    vite: 7.1.8 => 7.1.8

Used Package Manager

npm

Logs

No response

Validations

I believe the cause is probably something regarding #20837

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions