Skip to content

Regression in 6.2.0: device monitor rejects piped stdout even when stdin is a TTY #5551

Backlog

Description

@NicHub
  • PlatformIO Core

Configuration

  • Operating system: macOS 26.6 (arm64)
  • PlatformIO Core: 6.2.0

Steps to reproduce

From an interactive terminal, run:

pio device monitor --port loop:// | cat

loop:// avoids requiring a physical serial device. Only stdout is piped; stdin remains attached to the terminal. The same error occurs when piping a real device's output to jq.

Actual result

The monitor refuses to start:

UserSideException: `pio device monitor` requires an interactive terminal on stdin and cannot run with piped or redirected input. If you're scripting device I/O, talk to the serial port directly instead (e.g., with pyserial) rather than through `pio device monitor`.

Expected result

The monitor starts, reads keyboard input from the terminal, and writes its output to the pipe. It should still reject input that is not a TTY, as intended by #5503.

Additional information

In 6.2.0, new_terminal() calls is_terminal(), which checks sys.stdout.isatty(). That returns False for the pipe even though sys.stdin.isatty() is True. The guard was added in #5503 and is absent in 6.1.19.

Could the monitor check stdin specifically and add coverage for TTY stdin with piped stdout?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions