PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/exec/ls.e

http://github.com/tybor/Liberty
Specman e | 46 lines | 41 code | 5 blank | 0 comment | 1 complexity | 58abdbb8451a534195a7af3cc13a670c MD5 | raw file
 1class LS
 2
 3create {ANY}
 4   make
 5
 6feature {}
 7   make
 8      local
 9         pf: PROCESS_FACTORY; p: PROCESS
10      do
11         p := pf.execute("ls", {FAST_ARRAY[STRING] << "-l" >> })
12         from
13            check
14               p.output.is_connected
15            end
16            p.output.read_line
17         until
18            p.output.end_of_input
19         loop
20            std_output.put_string(p.output.last_string)
21            std_output.put_new_line
22            p.output.read_line
23         end
24
25         from
26            check
27               p.error.is_connected
28            end
29            p.error.read_line
30         until
31            p.error.end_of_input
32         loop
33            std_output.put_string(p.error.last_string)
34            std_output.put_new_line
35            p.error.read_line
36         end
37
38         p.wait
39         if p.status /= 0 then
40            std_error.put_string("Process finished with status ")
41            std_error.put_integer(p.status)
42            std_error.put_new_line
43         end
44      end
45
46end -- class LS