tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.41k stars 289 forks source link

tty in node in local_resource kills tilt #6387

Closed nicks closed 3 weeks ago

nicks commented 1 month ago

Related to https://github.com/tilt-dev/tilt/issues/6378, but the repro steps are slightly different :thinking:

Steps to Reproduce

Tiltfile:

local_resource(
    'test',
    ['node', './main.js'],
    stdin_mode='pty')

main.js:

const { spawn } = require('node:child_process');

let promise = new Promise((resolve, reject) => {
  let proc = spawn('/bin/zsh', [
    '-i',
    '-l',
    '-c',
    'echo exit',
  ]);

  proc.on('error', (err) => {
    console.log('ERROR PROCESS');
  });

  proc.on('close', (code, signal) => {
    console.log('CLOSE PROCESS');
  });
});

1) Run tilt up and wait a little while 2) Hit space

Expected Behavior

Tilt should successfully run the command

Current Behavior

On macOS, tilt crashes with suspended (tty input) On Linux, the terminal gets mysteriously detached from the tilt process