
1 // 2 // Copyright (c) 2006, Brian Frank and Andy Frank 3 // Licensed under the Academic Free License version 3.0 4 // 5 // History: 6 // 5 Nov 06 Brian Frank Creation 7 // 8 9 ** 10 ** Process manages spawning external OS processes. 11 ** 12 ** TODO: currently this API provides the bare necessities, need to add: 13 ** - async management 14 ** - stdin, stdout, stderr management 15 ** - env variables 16 ** - working directory 17 ** 18 final class Process 19 { 20 21 ////////////////////////////////////////////////////////////////////////// 22 // Constructor 23 ////////////////////////////////////////////////////////////////////////// 24 25 ** 26 ** Construct a Process instanced used to launch an external 27 ** OS process with the specified command arguments. 28 ** 29 new make(Str[] cmd, File dir := null) 30 31 ////////////////////////////////////////////////////////////////////////// 32 // Configuration 33 ////////////////////////////////////////////////////////////////////////// 34 35 ** 36 ** Command list used to launch process. 37 ** 38 Str[] command 39 40 ** 41 ** Working directory of process. 42 ** 43 File dir 44 45 ////////////////////////////////////////////////////////////////////////// 46 // Lifecycle 47 ////////////////////////////////////////////////////////////////////////// 48 49 ** 50 ** Run this process and wait until it completes. Return the 51 ** exit code of the process. 52 ** 53 Int run() 54 55 }