gspawn.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {*
  2. * gspawn.inc
  3. *
  4. * depends on gerror.inc
  5. *}
  6. { I'm not sure I remember our proposed naming convention here. }
  7. function G_SPAWN_ERROR : TGQuark;
  8. type
  9. PGSpawnError = ^TGSpawnError;
  10. TGSpawnError = (G_SPAWN_ERROR_FORK,
  11. G_SPAWN_ERROR_READ,
  12. G_SPAWN_ERROR_CHDIR,
  13. G_SPAWN_ERROR_ACCES,
  14. G_SPAWN_ERROR_PERM,
  15. G_SPAWN_ERROR_2BIG,
  16. G_SPAWN_ERROR_NOEXEC,
  17. G_SPAWN_ERROR_NAMETOOLONG,
  18. G_SPAWN_ERROR_NOENT,
  19. G_SPAWN_ERROR_NOMEM,
  20. G_SPAWN_ERROR_NOTDIR,
  21. G_SPAWN_ERROR_LOOP,
  22. G_SPAWN_ERROR_TXTBUSY,
  23. G_SPAWN_ERROR_IO,
  24. G_SPAWN_ERROR_NFILE,
  25. G_SPAWN_ERROR_MFILE,
  26. G_SPAWN_ERROR_INVAL,
  27. G_SPAWN_ERROR_ISDIR,
  28. G_SPAWN_ERROR_LIBBAD,
  29. G_SPAWN_ERROR_FAILED);
  30. TGSpawnChildSetupFunc = procedure (user_data:gpointer);cdecl;
  31. { look for argv[0] in the path i.e. use execvp() }
  32. { Dump output to /dev/null }
  33. PGSpawnFlags = ^TGSpawnFlags;
  34. TGSpawnFlags = integer;
  35. const
  36. G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 shl 0;
  37. G_SPAWN_DO_NOT_REAP_CHILD = 1 shl 1;
  38. G_SPAWN_SEARCH_PATH = 1 shl 2;
  39. G_SPAWN_STDOUT_TO_DEV_NULL = 1 shl 3;
  40. G_SPAWN_STDERR_TO_DEV_NULL = 1 shl 4;
  41. G_SPAWN_CHILD_INHERITS_STDIN = 1 shl 5;
  42. G_SPAWN_FILE_AND_ARGV_ZERO = 1 shl 6;
  43. function g_spawn_error_quark:TGQuark;cdecl;external gliblib name 'g_spawn_error_quark';
  44. function g_spawn_async(working_directory:Pgchar; argv:PPgchar; envp:PPgchar; flags:TGSpawnFlags; child_setup:TGSpawnChildSetupFunc;
  45. user_data:gpointer; child_pid:Pgint; error:PPGError):gboolean;cdecl;external gliblib name 'g_spawn_async';
  46. { Opens pipes for non-NULL standard_output, standard_input, standard_error,
  47. and returns the parent's end of the pipes.
  48. }
  49. function g_spawn_async_with_pipes(working_directory:Pgchar; argv:PPgchar; envp:PPgchar; flags:TGSpawnFlags; child_setup:TGSpawnChildSetupFunc;
  50. user_data:gpointer; child_pid:Pgint; standard_input:Pgint; standard_output:Pgint; standard_error:Pgint;
  51. error:PPGError):gboolean;cdecl;external gliblib name 'g_spawn_async_with_pipes';
  52. { If standard_output or standard_error are non-NULL, the full
  53. standard output or error of the command will be placed there.
  54. }
  55. function g_spawn_sync(working_directory:Pgchar; argv:PPgchar; envp:PPgchar; flags:TGSpawnFlags; child_setup:TGSpawnChildSetupFunc;
  56. user_data:gpointer; standard_output:PPgchar; standard_error:PPgchar; exit_status:Pgint; error:PPGError):gboolean;cdecl;external gliblib name 'g_spawn_sync';
  57. function g_spawn_command_line_sync(command_line:Pgchar; standard_output:PPgchar; standard_error:PPgchar; exit_status:Pgint; error:PPGError):gboolean;cdecl;external gliblib name 'g_spawn_command_line_sync';
  58. function g_spawn_command_line_async(command_line:Pgchar; error:PPGError):gboolean;cdecl;external gliblib name 'g_spawn_command_line_async';