Added types for subprocess operations.

original commit: 20ed3b809669a93191776067d4c83f3562699aef
This commit is contained in:
Eric Dobson 2011-06-23 12:59:06 -04:00 committed by Sam Tobin-Hochstadt
parent a8af94e892
commit 05e3f8859b
2 changed files with 82 additions and 1 deletions

View File

@ -1532,13 +1532,92 @@
(-poly (a) ((list (-vec a)) -Integer . ->* . (-values (list (-vec a) (-vec a)))))]
;Section 14.4 (Processes)
;; scheme/system
[subprocess
(let ((ret-type (-values (list -Subprocess (-opt -Input-Port) (-opt -Output-Port) (-opt -Input-Port)))))
(cl->*
(->* (list (-opt -Output-Port) (-opt -Input-Port) (-opt -Output-Port) -Pathlike)
(Un -Path -String -Bytes) ret-type)
(-> (-opt -Output-Port) (-opt -Input-Port) (-opt -Output-Port) -Pathlike (-val 'exact) -String ret-type)))]
[subprocess-wait (-> -Subprocess -Void)]
[subprocess-status (-> -Subprocess (Un (-val 'running) -Nat))]
[subprocess-kill (-> -Subprocess Univ -Void)]
[subprocess-pid (-> -Subprocess -Nat)]
[subprocess? (make-pred-ty -Subprocess)]
[current-subprocess-custodian-mode (-Param (Un (-val #f) (-val 'kill) (-val 'interrupt))
(Un (-val #f) (-val 'kill) (-val 'interrupt)))]
[subprocess-group-enabled (-Param Univ B)]
[shell-execute (-> (-opt -String) -String -String -Pathlike Sym (-val #f))]
;Section 14.4.1 (racket/system)
[system ((Un -String -Bytes) . -> . -Boolean)]
[system* ((list -Pathlike) (Un -Path -String -Bytes) . ->* . -Boolean)]
[system/exit-code ((Un -String -Bytes) . -> . -Byte)]
[system*/exit-code ((list -Pathlike) (Un -Path -String -Bytes) . ->* . -Byte)]
[process (-> -String
(-values (list -Input-Port -Output-Port -Nat -Input-Port
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void)))))]
[process*
(cl->*
(->* (list -Pathlike) (Un -Path -String -Bytes)
(-values (list -Input-Port -Output-Port -Nat -Input-Port
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void)))))
(-> -Pathlike (-val 'exact) -String
(-values (list -Input-Port -Output-Port -Nat -Input-Port
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void))))))]
[process/ports
(-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -String
(-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port)
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void)))))]
[process*/ports
(cl->*
(->* (list (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -Pathlike)
(Un -Path -String -Bytes)
(-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port)
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void)))))
(-> (-opt -Output-Port) (-opt -Input-Port) (Un -Output-Port (-val #f) (-val 'stdout)) -Pathlike (-val 'exact) -String
(-values (list (-opt -Input-Port) (-opt -Output-Port) -Nat (-opt -Input-Port)
(cl->*
(-> (-val 'status) (Un (-val 'running) (-val 'done-ok) (-val 'done-error)))
(-> (-val 'exit-code) (-opt -Byte))
(-> (-val 'wait) ManyUniv)
(-> (-val 'interrupt) -Void)
(-> (-val 'kill) -Void))))))]
;; probably the most useful cases
[curry (-poly (a b c)

View File

@ -227,6 +227,8 @@
#'internal-definition-context?
internal-definition-context?
#'-Internal-Definition-Context))
(define -Subprocess
(make-Base 'Subprocess #'subprocess? subprocess? #'-Subprocess))