Skip to content

Improvement (logging): turbo watch silently fails to watch files in non-TTY environments (systemd, Docker) #11677

@timcharper

Description

@timcharper

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

  1. Add an environment variable to override this behavior for when turbo watch is run in non-tty environments.
  2. Add additional logging (that is shown by default and not only hinted at when TURBO_LOG_VERBOSITY=debug is 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:

  1. The only indication is a debug! log message - easily missed
  2. The --daemon flag is not available on turbo watch (only turbo run)
  3. The watch command continues running without any warning that watching is disabled

Does the docs page already exist? Please link to it.

no

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions