Skip to content

Don't print evaluation result when adding implicit parens #161

@ALSchwalm

Description

@ALSchwalm

Currently when the implicit (sh/$? ...) wrapper is added to a chunk, we still print the result as usual. This results in a somewhat odd output like:

/home/adam/repos/janetsh $ ls /
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
0
/home/adam/repos/janetsh $ 

With the extra return code being printed after the output. This is a bit jarring, and I think removing it would be reasonable. Note that I don't think that /every/ call to sh/$? (and friends) should have this behaviour, but for the special case of implicit parens, it seems reasonable. We could also store the return code in a variable.

That said, I think actually implementing this would require we pull in most of the repl logic from janet, as I don't really see a good way to hook this otherwise. We can use a dynamic binding and a custom onsignal callback, but there is no obvious place we could set the binding that would be in effect when repl actually calls out to the onsignal handler.

Before going through that, I wanted to go ahead and open this to see if you like the idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions