execute.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Creation of autonomous subprocesses.
  2. Copyright (C) 2001-2003, 2008-2013 Free Software Foundation, Inc.
  3. Written by Bruno Haible <haible@clisp.cons.org>, 2001.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _EXECUTE_H
  15. #define _EXECUTE_H
  16. #include <stdbool.h>
  17. /* Execute a command, optionally redirecting any of the three standard file
  18. descriptors to /dev/null. Return its exit code.
  19. If it didn't terminate correctly, exit if exit_on_error is true, otherwise
  20. return 127.
  21. If ignore_sigpipe is true, consider a subprocess termination due to SIGPIPE
  22. as equivalent to a success. This is suitable for processes whose only
  23. purpose is to write to standard output.
  24. If slave_process is true, the child process will be terminated when its
  25. creator receives a catchable fatal signal.
  26. If termsigp is not NULL, *termsig will be set to the signal that terminated
  27. the subprocess (if supported by the platform: not on native Windows
  28. platforms), otherwise 0.
  29. It is recommended that no signal is blocked or ignored while execute()
  30. is called. See pipe.h for the reason. */
  31. extern int execute (const char *progname,
  32. const char *prog_path, char **prog_argv,
  33. bool ignore_sigpipe,
  34. bool null_stdin, bool null_stdout, bool null_stderr,
  35. bool slave_process, bool exit_on_error,
  36. int *termsigp);
  37. #endif /* _EXECUTE_H */