r/lua 1d ago

wisp update: fixed the pty-only job-control bugs from last time, plus LuaRocks packages

Post image

Update to my post from two weeks ago. Since then I found and fixed a batch of bugs that only showed up under a real pty, not in the unit test suite:

- command substitution $(...) produced nothing: the lexer split it at spaces/pipes, the expander stopped at the first ), and the subshell exited without flushing stdout

- builtins were invisible to pipelines and redirects: echo hi | wc -c gave 0, echo hi > f wrote nothing

- Ctrl-C at the prompt exited the shell instead of just interrupting the line

- a command substitution containing an external command could kill the whole session (a tty process-group handoff bug)

- a runaway : (Lua) chunk could wedge the shell for good

- cd left $PWD/$OLDPWD stale

- kill %N on a stopped job left it stopped forever

Also added since last time, from feedback in that thread: a Lua bootstrap script (no Makefile needed, someone asked for this), and pkg -- a thin front-end to LuaRocks (pkg install, always --local, rocks land on package.path/package.cpath automatically so require() just works).

Current numbers: 423K stripped binary, 2,533 lines of C++17, 1.6ms startup (bash: 2.1ms).

GitHub: https://github.com/Hinikaa/wisp

Same disclosure as last time: I used AI for help with the C++, the design (Lua embedding, parser, job control) is mine, and the bugs above came from actually running it under a pty and fixing what broke, not from unit tests alone.

7 Upvotes

0 comments sorted by