Skip to content

Terminal width probe fails under Claude Code ≥ 2.1.139 (no controlling TTY for spawned statusline) #376

Closed

Description

@AgarwalPragy

Summary

On Linux under Claude Code ≥ 2.1.139, ccstatusline's TTY-width probe fails entirely and falls back to tput cols → 80. With the default flexMode: "full-minus-40", the statusline truncates at 40 columns regardless of actual terminal width.

Root cause

Claude Code 2.1.139 changelog:

Fixed a bug where a hook writing to the terminal could corrupt an on-screen interactive prompt; hooks now run without terminal access.

The statusLine spawn is hardened the same way. The ancestor walk in probeTerminalWidth correctly finds the controlling PTY, but getWidthForTTY's stty size < /dev/${tty} form fails with ENOTTY when the calling process has no controlling terminal.

Reproduction

$ stty size < /dev/pts/0
stty: Inappropriate ioctl for device
$ stty -F /dev/pts/0 size
36 159

Reproducible without ccstatusline via setsid -w bash -c 'stty size < /dev/pts/0' — confirms it's generic, not terminal-emulator-specific.

Fix

Use stty -F <path> size (GNU coreutils) or stty -f <path> size (BSD); they open the device internally and succeed regardless of controlling-tty status. PR coming.

Related

Open requests to expose terminal.width in the statusLine JSON, which would future-proof this independently:

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions