Change parser to do C style () for operators: 1+2*3 == 1+(2)*3
[io/jrb1.git] / addons / SystemCall / io / SystemCall.io
blobde6ef949a35afe7a62a677611ea1dead5b142d27
3 SystemCall do(
4 newSlot("command", "")
5 newSlot("isRunning", false)
6 newSlot("returnCode", nil)
7 newSlot("stdin", nil)
8 newSlot("stdout", nil)
9 newSlot("stderr", nil)
10 newSlot("arguments", nil)
11 newSlot("environment", Map clone)
13 init := method(
14 self arguments := List clone
15 self environment := environment clone
18 run := method(aBlock,
19 err := self asyncRun(command, arguments, environment)
20 if(err == -1, Exception raise("unable to run command"))
22 // replace this with something to watch the file streams?
23 isRunning := true
24 while(isRunning == true and (s := self status) > 255,
25 if(aBlock, aBlock call)
26 wait(.1)
28 if(aBlock, aBlock call)
30 isRunning := false
31 setReturnCode(s)
32 self
35 runWith := method(
36 run(Block clone setMessage(call argAt(0)) setScope(self))
39 with := method(s,
40 newSysCall := self clone
41 parts := s splitNoEmpties(" ")
42 newSysCall setCommand(parts removeFirst)
43 newSysCall setArguments(parts)
44 newSysCall