JanetDocsI'm feeling luckyGitHub sign in

os/spawn



    cfunction

    (os/spawn args &opts flags env)

    Execute a program on the system and return a handle to the process.
    Otherwise, the same arguments as os/execute. Does not wait for the
    process.


2 examplesSign in to add an example
Loading...
(def p (os/spawn ["ls"] :p {:in :pipe :out :pipe})) # define core/process with selfpipe
(pp (:read (p :out) :all)) # => prints the ls output
(pp (:wait p)) # => waits for the process to finish, prints 0 if succesful 
pepe
(def p1 (os/spawn ["echo" "hello"] :p {:out :pipe}))
(def p2 (os/spawn ["grep" "hello"] :p {:in (p1 :out)}))

(:wait p2)
# Creates a pipeline (e.g. echo hello | grep hello)
bakpakin