A virtual jailed shell environment for Go apps backed by an io/fs#FS.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(python3): default bare invocation to -i -S and unbuffer stdio

Bare \`python3\` under sophia would slurp stdin to EOF before doing
anything — Python's non-TTY default treats stdin as a script. Inject
-i when no args are given so it eval-prints line by line, and -S to
skip site.py: under -i, site appends cwd ('/') to sys.path and
listdir-walks '/' trying to import readline, which fails on the s3fs
mount and takes the REPL down before the first prompt.

Also set PYTHONUNBUFFERED=1 so the interpreter flushes after each
line instead of waiting for its block buffer to fill. The pipe-backed
stdio sophia now provides is line-oriented from the user's side; an
unflushed Python buffer makes the REPL look frozen.

Assisted-by: Claude Opus 4.7 via Claude Code
Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso 4421e350 ad8ae546

+11
+11
command/internal/python3/python3.go
··· 37 37 type Impl struct{} 38 38 39 39 func (Impl) Exec(ctx context.Context, ec *command.ExecContext, args []string) error { 40 + // Bare `python3` would otherwise slurp stdin to EOF before executing 41 + // (the non-TTY default), which hangs the REPL under sophia. Force 42 + // interactive mode so it eval-prints line by line. -S skips site.py, 43 + // which under -i would inject cwd ('/') into sys.path and try to 44 + // import readline by listdir-walking '/' — that path fails on s3fs 45 + // and brings down the REPL before the first prompt. 46 + if len(args) == 0 { 47 + args = []string{"-i", "-S"} 48 + } 49 + 40 50 fsConfig := wazero.NewFSConfig().(sysfs.FSConfig). 41 51 WithSysFSMount(billyfs.New(ec.FS), "/") 42 52 ··· 46 56 WithStderr(ec.Stderr). 47 57 WithArgs(append([]string{"python3"}, args...)...). 48 58 WithName("python3"). 59 + WithEnv("PYTHONUNBUFFERED", "1"). 49 60 WithFSConfig(fsConfig). 50 61 WithSysNanosleep(). 51 62 WithSysNanotime().