Enable CLI Usage on Windows #83
nickmccarty
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Windows, no
colabcommand runs at all — not justconsole.console.pyimports the POSIX-onlytermios/ttymodules at module top level, and becausecommands/execution.pydoesfrom colab_cli.console import connect_consoleat load time, the import chain fails before Typer ever dispatches a subcommand. Evencolab -hcrashes.Environment
google-colab-cli0.6.0 (from PyPI)Repro
(
import colab_cli.clireproduces it directly, no CLI invocation needed.)Root cause
console.pyunconditionally doesimport termios/import ttyat the top. These modules are Unix-only. They're only actually used insideconnect_console, and only on a real POSIX TTY (raw-mode setup +SIGWINCH). So the top-level import is the only thing preventing the CLI from working on Windows — the rest of the surface (new,exec,run,sessions,install, …) has no POSIX dependency.Suggested fix
Guard the imports and only take the raw-terminal path when those modules are present. Piped/agent usage sets
is_tty=Falseand never touches them, so behavior is unchanged everywhere it works today; interactivecolab consoleon Windows would fall back to line-buffered input instead of crashing.Then in
connect_console:I applied this locally and confirmed native Windows then works end-to-end (
colab -h, ADC auth, and acolab runCPU one-shot against a real Colab VM). Happy to share more detail if useful -- in the meantime, thank you for all your efforts!All reactions