symfony/process · error · RuntimeException
TTY mode is not supported on Windows platform.
Error message
TTY mode is not supported on Windows platform.
What it means
setTty(true) throws this RuntimeException on Windows (DIRECTORY_SEPARATOR === '\\'), where TTY mode for child processes is not supported by the library. Requesting a TTY means attaching the child's input/output to the terminal, a POSIX-oriented feature.
Solutions
- Guard setTty(true) with a platform check (PHP_OS_FAMILY !== 'Windows') and skip it on Windows.
- Remove TTY mode if interactivity is not required.
- On Windows, pass input via setInput()/stdin instead of a TTY.
Example fix
// before
$process->setTty(true);
// after
if (PHP_OS_FAMILY !== 'Windows') {
$process->setTty(true);
} Defensive patterns
Strategy: validation
Validate before calling
if (PHP_OS_FAMILY !== 'Windows' && $wantTty) {
$process->setTty(true);
} Try / catch
try {
$process->setTty(true);
} catch (\RuntimeException $e) {
// Windows: run without TTY
} Prevention
- Gate TTY-dependent behavior on PHP_OS_FAMILY checks.
- Test CLI tooling on Windows runners to catch platform-specific paths.
When it happens
Trigger: Calling setTty(true) in code executed on a Windows platform.
Common situations: Cross-platform scripts (CLI tools, deployment scripts, tests) that enable TTY for interactive feel and run on Windows; CI environments on Windows runners.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- This PHP has been compiled with --enable-sigchild. Term…
- TTY mode requires /dev/tty to be read/writable.
- Disabling output while the process is running is not…
- Output cannot be disabled while an idle timeout is set.
- Enabling output while the process is running is not…
AI-assisted analysis of symfony/process@99b85026db (2026-09-14).
Data as JSON: /api/errors/b6993a47d35852a4.
Report an issue: GitHub.
Appendix: source
Thrown at Process.php:1083
throw new LogicException('Idle timeout cannot be set while the output is disabled.');
}
$this->idleTimeout = $this->validateTimeout($timeout);
return $this;
}
/**
* Enables or disables the TTY mode.
*
* @return $this
*
* @throws RuntimeException In case the TTY mode is not supported
*/
public function setTty(bool $tty): static
{
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}
if ($tty && !self::isTtySupported()) {
throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
}
$this->tty = $tty;
return $this;
}
/**
* Checks if the TTY mode is enabled.
*/
public function isTty(): bool
{
return $this->tty;
}View on GitHub (pinned to 99b85026db)