/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

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