Open rprtr258 opened 2 months ago
Thanks @rprtr258
I'll review all this, but I think a couple of these issues I have started to fix already. Others not yet.
Regarding the CLI and shebang lines, this branch has relevant improvements: https://github.com/risor-io/risor/compare/cli-fix?expand=1
The splat operator issue I came across as well and have started to implement here: https://github.com/risor-io/risor/compare/variadic-calls?expand=1
I think that branch needs a bit more work.
I agree the exec module has a couple deficiencies. I'll review your comments in more detail.
exec.command
has signature with variadic arguments:but user functions cannot have variadic arguments, nor there is spread operator. So, I cannot write function like:
cli
package doesn't work for me.so, when shebang is
#!/usr/bin/env risor --
it givesIf we fix shebang to
#!/usr/bin/env -S risor --
, following program is being executed:which in turn calls
BUT, as I understood,
risor
for some reason requires script to be in formrisor script.risor -- $ARGS
so actual behavior now is open risor repl. Though, for now this can be sidestepped with following shebang:risor
correctly,os.args
gives array of strings from$ARGS
we passed along. BUT it should also include the script, such thatos.args() == ["./script.rasor", $ARGS...]
. Because of that, I cannot passos.args()
tocli.app.run()
because the latter requires executable to be the first argument, which again can be sidestepped for now with.run(["vahui"] + os.args())
exec
: there is no way to catch exit code. The only way to not fail script and handle failed command for now goes likesuch wrapper can be useful for e.g. printing failed command, printing it's stderr to get reason of failure, instead of just
which is not informative at all.