-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
What is the improvement or update you wish to see?
Problem
When running turbo watch from a non-interactive environment (systemd service, Docker container without TTY, etc.), file watching silently does not work. The command appears to run successfully, but file changes are never detected.
Workaround
Set daemon: true in .turbo/config.json:
Ideal fix
- Add an environment variable to override this behavior for when
turbo watchis run in non-tty environments. - Add additional logging (that is shown by default and not only hinted at when
TURBO_LOG_VERBOSITY=debugis set; output a warning with a brief note about how to override the behavior. (since running turbo watch in "ci" mode is atypical....)
Is there any context that might help us understand?
Root Cause
The daemon initialization logic in crates/turborepo-lib/src/run/builder.rs:242-250 skips the daemon when stdout is not a TTY:
let is_ci_or_not_tty = turborepo_ci::is_ci() || !std::io::stdout().is_terminal();
let daemon = match (is_ci_or_not_tty, self.opts.run_opts.daemon) {
(true, None) => {
debug!("skipping turbod since we appear to be in a non-interactive context");
None
}
// ...
};
Since turbo watch relies on the daemon for file change events (via package_changes() gRPC stream), this effectively disables file watching. However:
- The only indication is a debug! log message - easily missed
- The --daemon flag is not available on turbo watch (only turbo run)
- The watch command continues running without any warning that watching is disabled
Does the docs page already exist? Please link to it.
no