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

  1. Guard setTty(true) with a platform check (PHP_OS_FAMILY !== 'Windows') and skip it on Windows.
  2. Remove TTY mode if interactivity is not required.
  3. 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

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


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)