#lang scheme/base
(require (planet bzlib/base) "path.ss" scheme/system)
(define (sys/call exe . args)
(let ((cout (open-output-bytes))
(cerr (open-output-bytes))
(path (exe-path exe)))
(if (not path)
(error 'sys/call "Unknown program: ~a" exe)
(parameterize ((current-output-port cout)
(current-error-port cerr))
(let ((code (apply system*/exit-code (exe-path exe) args)))
(values (= code 0)
code
(get-output-bytes cout)
(get-output-bytes cerr)))))))
(trace sys/call)
(provide/contract
(sys/call (->* (string?)
()
#:rest (listof string?)
(values boolean?
number?
bytes?
bytes?)))
)