Commit Graph

4 Commits

Author SHA1 Message Date
Cormac Shannon
f09a033160 Replace upvalue-based shell dispatch with OP_LUSH opcode
Add a dedicated OP_LUSH A B instruction that loads shell C functions
directly from the registry, eliminating the need for upvalue allocation
in mainfunc(), upvalue population in lua_load(), and the fragile
LUSH_NUM_UPVALS heuristic. Every chunk no longer carries 4 extra
upvalues.
2026-03-12 22:47:25 +00:00
Cormac Shannon
f88b17959f Hide shell functions from _G using upvalues on the main chunk
Store __command, __interactive, __getenv, __setenv as upvalues
populated by lua_load() from the registry, keeping them invisible
to user code while accessible to the parser's codegen.
2026-03-12 22:46:56 +00:00
Cormac Shannon
db858b3f68 Implement prefix-based interactive commands via ! (issue #14)
Add !command syntax that runs commands with inherited terminal (no
capture). The lexer treats ! as a statement-starting token, reading
to end-of-line with the same interpolation/escape/pipe support as
backtick commands. The C function sets _ = {code=N, stdout="", stderr=""}.
2026-03-02 22:06:29 +00:00
Cormac Shannon
39d6cc95cb Add command execution runtime (lcmd.c, lcmd.h)
Implements luaB_command: fork/execvp with pipe-captured stdout/stderr,
argv parsing with quoting/escaping, and non-blocking pipe reading via
select(). Backs the __command() calls emitted by the backtick parser.

Resolves #03 and #04.
2026-02-28 18:27:42 +00:00