1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
13 type t = In.t * Out.t -> unit
21 (* Execute a program in a subprocess and wait for it to finish.
22 * call (file, args) (i, o) searches PATH for an executable named file,
23 * and runs it with arguments file :: args.
25 val call: string * string list -> Command.t
26 (* call' (c, a) = call (c, a) (In.standard, Out.standard) *)
27 val call': string * string list -> unit
28 val callWithIn: string * string list * (In.t -> 'a) -> 'a
29 val callWithOut: string * string list * (Out.t -> 'a) -> 'a
31 * Fork off a command and collect its output into a string.
33 val collect: Command.t -> string
34 val commandName: unit -> string
35 val doesSucceed: (unit -> unit) -> bool
36 val doubleFork: (unit -> unit) -> unit
37 val exec: string * string list -> unit
38 (* Raise Fail exception. *)
39 val fail: string -> 'a
40 (* Start a command in a subprocess, in the background. *)
41 val fork: (unit -> unit) -> Pid.t
42 val forkIn: (Out.t -> unit) -> Pid.t * In.t
43 val forkOut: (In.t -> unit) -> Pid.t * Out.t
44 val forkInOut: (In.t * Out.t -> unit) -> Pid.t * In.t * Out.t
45 val getEnv: string -> string option
47 * glob s returns the list of paths matching s.
48 * For now, s should be a bash pattern.
50 val glob: string -> string list
51 val hostName: unit -> string
52 val makeCommandLine: (string list -> unit) -> (string list -> Status.t)
53 val makeMain: (string list -> unit) -> (unit -> unit)
54 (* pipe [c_1, ..., c_n] runs the commands c_1, ..., c_n in
55 * subprocesses in parallel, with the standard output of c_i hooked
56 * to the standard input of c_i+1.
57 * Fails if any of the commands fail.
59 val pipe: Command.t list * In.t * Out.t -> unit
60 (* pipe' cs = pipe (cs, In.standard, Out.standard) *)
61 val pipe': Command.t list -> unit
62 (* run = wait o fork *)
63 val run: (unit -> unit) -> unit
64 val setEnv: {name: string, value: string} -> unit
65 val signal: Pid.t * Signal.t -> unit
66 val signalGroup: Pid.t * Signal.t -> unit
67 val size: File.t -> {text: int, data: int, bss: int}
68 val sleep: Time.t -> Time.t
69 val spawn: {path: string, args: string list} -> Pid.t
70 val spawne: {path: string, args: string list, env: string list} -> Pid.t
71 val spawnp: {file: string, args: string list} -> Pid.t
72 val su: string -> unit (* string is userid *)
73 val succeed: unit -> 'a
74 val system: string -> unit
75 val time: (unit -> unit) -> {system: Time.t, user: Time.t}
76 (* try (f, m) tries f with exponentially backed off times, stopping after
77 * a minute of trying, in which case is fails with m.
79 val try: (unit -> 'a) * string -> 'a
80 val usage: {usage: string, msg: string} -> 'a
81 val userName: unit -> string
82 (* Wait for process to finish.
83 * Raise Fail if process terminates with nonzero status.
85 val wait: Pid.t -> unit
86 (* Wait for all Pid.ts in list to finish. *)
87 val waits: Pid.t list -> unit
88 (* watch f will rerun f until it succeeds *)
89 val watch: (unit -> unit) -> unit
93 datatype t = DiskSleep | Running | Sleeping | Traced | Zombie
95 val toString: t -> string
98 val ps: unit -> {name: string,
106 functor TestProcess (S: PROCESS): sig end =
109 val _ = print "TestProcess\n"