Documentation
¶
Overview ¶
Package cli implements a python-compatible command front-end on top of the go-python interpreter.
It is intentionally a library, not just a main package: a single-binary sandbox can embed the python command by importing this package and calling Run with its own argv and io streams, while cmd/python is only a thin wrapper (os.Exit(cli.Run(os.Args, os.Stdin, os.Stdout, os.Stderr))).
Supported today: `python -c <command>` and `python <file.py> [args...]`, both with sys.argv populated and code run in a real __main__ module. Module (-m) and interactive (REPL) modes return a usage error for now.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes a python-style invocation and returns a process exit code, following CPython's conventions: 0 on success, 1 on an uncaught exception, 2 on a command-line / file-open error.
args is the full argv including args[0] (the program name). stdin backs the guest's sys.stdin; stdout/stderr receive program output. Run never writes to the host process streams directly — everything goes through the passed writers — so it is safe to call in-process from an embedding sandbox.
Types ¶
This section is empty.