Windows sandbox: a command that fails before starting leaves sandbox-helper.exe running

Cerrado Apto para principiantes
#162 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust, typescript
Área
desktop, testing

Línea de trabajo

Empieza con HelperProcess.fail() en src/main/tools/sandbox_windows.ts y la prueba del helper falso en sandbox_windows.test.ts:291; compara el comportamiento del EOF de stdin del helper real en native/sandbox-helper/src/win.rs:216-252. Actualiza el helper falso para que siga ejecutándose hasta que se cierre stdin; luego verifica que el helper se cierre después de fail() y ejecuta las pruebas de sandbox de Windows.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug platform: windows priority: high severity: high

Found in the 2026-10-07 code review (traced on both the TypeScript and Rust sides).

Problem

HelperProcess.finish() (src/main/tools/sandbox_windows.ts:365-377) ends the helper's stdin, but fail() (:356-363) does not. The helper's serve loop (native/sandbox-helper/src/win.rs:216-252) only exits when stdin reaches EOF. After run() returns Err, it sends Error{id} and waits for more input. ShellRunner treats 'error' as finished and never calls killTree. Background entries get exitCode = null, so stopBackground skips them too.

Scenario

Every error before the command starts leaves one idle helper process with three pipes: a lock timeout, missing git metadata, a CreateAppContainerProfile/CreateProcessW failure, no free drive letter, or a cancel during preparation. A model that retries a failing command piles them up until Patch quits.

Why the tests miss it

The fake helper in sandbox_windows.test.ts:291 calls process.exit(0) after sending error. The real helper doesn't exit.

Fix

private fail(message: string): void {
  if (this.done) return;
  this.done = true;
  this.helper.stdin?.end();   // the helper exits once its input closes
  this.stdout.end();
  this.stderr.end();
  this.emit('error', new Error(message));
  this.emit('close', null);
}

Make the fake helper stay alive until its stdin closes, and assert that the helper process exited after fail().

Lenguaje dominante
TypeScript
Estrellas
2
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.