Skip to content

fix: Windows termios crash and portable Drive auth prompt - #135

Open
unn-Known1 wants to merge 2 commits into
googlecolab:mainfrom
unn-Known1:fix-windows-termios-and-kernel-client-compat
Open

unn-Known1 wants to merge 2 commits into
googlecolab:mainfrom
unn-Known1:fix-windows-termios-and-kernel-client-compat

Conversation

@unn-Known1

@unn-Known1 unn-Known1 commented Sep 20, 2026 •

Copy link
Copy Markdown

Summary

Fixes Windows crashes (scoped to Windows support per review — kernel-client part dropped, already covered by #125):

  1. Every command crashes with ModuleNotFoundError: No module named 'termios'

    • src/colab_cli/console.py imported termios/tty unconditionally.
    • Import chain cli -> commands/execution -> console broke even colab new / colab --help.
    • Fix: optional import (termios = None on ImportError), can_raw gate, getattr(signal, 'SIGWINCH', None) guard. Degrades to line-buffered input.
    • Tests: optional import + needs_termios skips, test_console_no_termios_degrades_gracefully.
  2. colab drivemount Drive auth prompt uses /dev/tty (missing on Windows)

    • Fix in automation.py: try /dev/tty, fall back to sys.stdin.readline() / input().

Rebased

Verification

  • uv run pytest tests/test_console.py tests/test_runtime.py -v: 16 passed (incl. new graceful-degradation test + upstream fallback test).
  • uv run ruff check: clean.

@google-cla

google-cla Bot commented Sep 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@EvanWiederspan

Copy link
Copy Markdown
Contributor

Tried it out on my Windows laptop and looks pretty good! Thanks for sending this.

There's some merge conflicts to resolve. Also, we've pinned the jupyter-kernel-client package for now, so I'd prefer if you removed the class changes for now to keep this PR focused on Windows support

- console.py: guard termios/tty imports (missing on Windows) so every
  command no longer crashes with ModuleNotFoundError via
  cli -> execution -> console. Degrades to line-buffered input,
  guards SIGWINCH which doesn't exist on Windows.
- tests: optional termios import + skip markers, graceful-degradation test.
@unn-Known1
unn-Known1 force-pushed the fix-windows-termios-and-kernel-client-compat branch from b3bcdac to 14787f4 Compare October 1, 2026 07:26
@unn-Known1 unn-Known1 changed the title fix: Windows termios crash and jupyter-kernel-client 1.x compat fix: Windows termios crash and portable Drive auth prompt Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants