Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    andrewchambers
    @andrewchambers
    so you can go
    (sh/exec :2> '1)
    or (sh/exec ls )
    sorry
    (sh/$ exec ...)
    technically you can exec in a pipeline, but it makes no sense
    andrewchambers
    @andrewchambers
    The last two features for 0.1 I want, non linear pipelines, and spawning processes and getting access to the FD's
    they might be related or not, trying to think how they should work
    andrewchambers
    @andrewchambers
    basically, how would you spawn netcat and connect it to a janet/sh repl
    without the -e command
    and also things like
    from bash you can do
    cat <(ls)
    But i think you can do
    cat < <(ls)
    which are slightly different
    though that is different again
    andrewchambers
    @andrewchambers
    For a second I was imagining something like:
    (procs
      :a ($ ls )
     :b ($ cat < :a)
    )
    Probably too crazy.
    a simple way might just be
    (let [[a b] (pipes)]  ($ ls > [a] &) ($ cat < [b]))
    andrewchambers
    @andrewchambers
    I am a fan of this simple way, even if it a bit manual, it seems easy to implement, and doesn't require much change at all.
    andrewchambers
    @andrewchambers
    andrewchambers
    @andrewchambers
    Woo
    now we can redirect into core/file
    andrewchambers
    @andrewchambers
    it's done
    andrewchambers
    @andrewchambers
    Another fun idea
    expand core/file instances on the command line to /dev/fd/N
    (that is why I was thinking about multimethods)
    so users can define how their own types get expanded into command line arguments
    pauldub
    @pauldub
    That would be a very nice feature
    andrewchambers
    @andrewchambers
    yeah, not too sure what other uses there are
    but there must be some good ones
    pauldub
    @pauldub
    It would be a nice interaction point between tools written in janet and the shell itself
    andrewchambers
    @andrewchambers
    One example I can think of is a bit like the nix package manager. A nix package is like table, but when expanded into a command line it becomes a path to the package
    the fd one is still the most useful, it lets you work around poorly written tools
    tool-with-only-file-args -f ($-pipe foo | sort | ... )
    Calvin Rose
    @bakpakin
    You could use prototypes on tables for that and add something like :sh-expand to any table
    andrewchambers
    @andrewchambers
    yeah
    I was thinking also for redirects
    foo > t
    and t can define how to get the file
    with the same mechanism
    @bakpakin basically the only feature I can't quite do in janetsh is exit traps
    but I think I have a work around
    something like (on-exit (fn [] ($ rm some-dir)))
    andrewchambers
    @andrewchambers
    I think an exit trap will need to be a forked janetsh that waits for a signal
    from the cleanup atexit handler before doing the action
    andrewchambers
    @andrewchambers
    the main problem being you can be told to exit from a SIGTERM