process.monkey2 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Namespace std.process
  2. #If __TARGET__<>"emscripten"
  3. #Import "native/process.cpp"
  4. #Import "native/procutil.cpp"
  5. #Import "native/process.h"
  6. Extern
  7. #rem The Process class.
  8. Note that stderr output handling is not yet implemented.
  9. #end
  10. Class Process="bbProcess"
  11. #rem monkeydoc Invoked when process has finished executing.
  12. #end
  13. Field Finished:Void()="finished"
  14. #rem monkeydoc Invoked when process has written to stdout.
  15. #end
  16. Field StdoutReady:Void()="stdoutReady"
  17. #rem monkeydoc Invoked when proces has written to stderr (TODO).
  18. #end
  19. Field StderrReady:Void()="stderrReady"
  20. #rem monkeydoc Process exit code.
  21. #end
  22. Property ExitCode:Int()="exitCode"
  23. #rem monkeydoc Process stdout bytes available to read.
  24. #end
  25. Property StdoutAvail:Int()="stdoutAvail"
  26. #rem monkeydoc Process stder bytes available to read (TODO).
  27. #end
  28. Property StderrAvail:Int()="stderrAvail"
  29. #rem monkeydoc Starts a new process.
  30. #end
  31. Method Start:Bool( cmd:String )="start"
  32. #rem monkeydoc Read process stdout.
  33. #end
  34. Method ReadStdout:String()="readStdout"
  35. Method ReadStdout:Int( buf:Void Ptr,count:Int )="readStdout"
  36. #rem monkeydoc Read process stderr (TODO).
  37. #end
  38. Method ReadStderr:String()="readStderr"
  39. Method ReadStderr:Int( buf:Void Ptr,count:Int )="readStderr"
  40. #rem monkeydoc Write process stdin.
  41. #end
  42. Method WriteStdin( str:String )="writeStdin"
  43. Method WriteStdin:Int( buf:Void Ptr,count:Int )="writeStdin"
  44. #rem monkeydoc Send break signal to process.
  45. #end
  46. Method SendBreak()="sendBreak"
  47. #rem monkeydoc Terminate process.
  48. #end
  49. Method Terminate:Void()="terminate"
  50. End
  51. #Endif