args to it, and returns 4 values: * the process's pid * the process's standard-input-port (for writing) * the process's standard-output-port (for reading) * the process's standard-error-port (for reading) See lab/process-example.ss for a sample usage.
17 lines
394 B
Scheme
Executable File
17 lines
394 B
Scheme
Executable File
#!/usr/bin/env scheme-script
|
|
|
|
(import (ikarus))
|
|
|
|
(let-values ([(pid in out err) (process "date")])
|
|
(printf "pid=~s\n" pid)
|
|
(let f ()
|
|
(let ([x (get-u8 out)])
|
|
(unless (eof-object? x)
|
|
(write-char (integer->char x))
|
|
(f))))
|
|
(flush-output-port)
|
|
(close-output-port in)
|
|
(close-input-port out)
|
|
(close-input-port err)
|
|
(printf "exit status = ~s\n" (waitpid pid)))
|