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