#lang scheme/base
(require "depend.ss" "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)))))))
(provide/contract
(sys/call (->* (string?)
()
#:rest (listof string?)
(values boolean?
number?
bytes?
bytes?)))
)