feat: add Windows native support via platform terminal abstraction#70
Open
woodhaha wants to merge 2 commits into
Open
feat: add Windows native support via platform terminal abstraction#70woodhaha wants to merge 2 commits into
woodhaha wants to merge 2 commits into
Conversation
Replace Unix-only `termios`/`tty`/`signal.SIGWINCH` with a cross-platform
`_terminal` module that uses the Windows Console API (SetConsoleMode /
GetConsoleMode via ctypes) on `nt` and the existing termios code on Unix.
Changes:
- NEW: src/colab_cli/_terminal.py — platform abstraction for raw mode,
resize handler registration, and terminal restoration
- MOD: src/colab_cli/console.py — import _terminal instead of
termios/tty/signal; use set_raw/restore/register_resize_handler
- MOD: src/colab_cli/commands/automation.py — /dev/tty → CON on Windows
- MOD: tests/test_console.py — update mocks for _terminal API
All 10 console + automation tests pass on Windows (6 console, 4 automation).
Verified end-to-end: colab new/exec/sessions all work natively on Windows.
Co-Authored-By: Claude <noreply@anthropic.com>
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace Unix-only
termios/tty/signal.SIGWINCHwith a cross-platform_terminalmodule, making Colab CLI run natively on Windows.Changes
src/colab_cli/_terminal.pySetConsoleMode/GetConsoleModeviactypeson Windows,termios/ttyon Unixsrc/colab_cli/console.pytermios/tty/signal.SIGWINCHwith_terminalAPIsrc/colab_cli/commands/automation.py/dev/tty→CONon Windows for Drive auth prompttests/test_console.py_terminalAPIHow it works
set_raw(fd)tty.setraw()restore(fd, old)SetConsoleModerestoretermios.tcsetattr()register_resize_handler(cb)os.get_terminal_size()@ 500mssignal.SIGWINCHTesting
colab --version/colab --helpworkscolab --auth=adc new -s test --gpu T4— session createdcolab --auth=adc exec -s test -f script.py— remote execution workscolab --auth=adc sessions— session listing works🤖 Generated with Claude Code