rollback to 3428, before the mysterious removal of libs/* at 3431/3432
[ardour.git] / libs / glibmm2 / glib / src / spawn.hg
1 /* $Id: spawn.hg,v 1.4 2004/03/02 23:29:57 murrayc Exp $ */
2
3 /* Copyright (C) 2002 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 _DEFS(glibmm,glib)
21
22 #include <string>
23 #include <sigc++/sigc++.h>
24 #include <glibmm/arrayhandle.h>
25 #include <glibmm/error.h>
26
27 #include <glibmmconfig.h>
28 GLIBMM_USING_STD(string)
29
30
31 namespace Glib
32 {
33
34 typedef GPid Pid;
35
36 _WRAP_ENUM(SpawnFlags, GSpawnFlags, NO_GTYPE)
37
38 /** @defgroup Spawn Spawning Processes
39  * Process launching with fork()/exec().
40  * @{
41  */
42
43 /** Exception class for errors occuring when spawning processes.
44  */
45 _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#)
46
47
48 void spawn_async_with_pipes(const std::string& working_directory,
49                             const Glib::ArrayHandle<std::string>& argv,
50                             const Glib::ArrayHandle<std::string>& envp,
51                             SpawnFlags flags = SpawnFlags(0),
52                             const sigc::slot<void>& child_setup = sigc::slot<void>(),
53                             Pid* child_pid = 0,
54                             int* standard_input = 0,
55                             int* standard_output = 0,
56                             int* standard_error = 0);
57
58 void spawn_async_with_pipes(const std::string& working_directory,
59                             const Glib::ArrayHandle<std::string>& argv,
60                             SpawnFlags flags = SpawnFlags(0),
61                             const sigc::slot<void>& child_setup = sigc::slot<void>(),
62                             Pid* child_pid = 0,
63                             int* standard_input = 0,
64                             int* standard_output = 0,
65                             int* standard_error = 0);
66
67 void spawn_async(const std::string& working_directory,
68                  const Glib::ArrayHandle<std::string>& argv,
69                  const Glib::ArrayHandle<std::string>& envp,
70                  SpawnFlags flags = SpawnFlags(0),
71                  const sigc::slot<void>& child_setup = sigc::slot<void>(),
72                  Pid* child_pid = 0);
73
74 void spawn_async(const std::string& working_directory,
75                  const Glib::ArrayHandle<std::string>& argv,
76                  SpawnFlags flags = SpawnFlags(0),
77                  const sigc::slot<void>& child_setup = sigc::slot<void>(),
78                  Pid* child_pid = 0);
79
80 void spawn_sync(const std::string& working_directory,
81                 const Glib::ArrayHandle<std::string>& argv,
82                 const Glib::ArrayHandle<std::string>& envp,
83                 SpawnFlags flags = SpawnFlags(0),
84                 const sigc::slot<void>& child_setup = sigc::slot<void>(),
85                 std::string* standard_output = 0,
86                 std::string* standard_error = 0,
87                 int* exit_status = 0);
88
89 void spawn_sync(const std::string& working_directory,
90                 const Glib::ArrayHandle<std::string>& argv,
91                 SpawnFlags flags = SpawnFlags(0),
92                 const sigc::slot<void>& child_setup = sigc::slot<void>(),
93                 std::string* standard_output = 0,
94                 std::string* standard_error = 0,
95                 int* exit_status = 0);
96
97 void spawn_command_line_async(const std::string& command_line);
98
99 void spawn_command_line_sync(const std::string& command_line,
100                              std::string* standard_output = 0,
101                              std::string* standard_error = 0,
102                              int* exit_status = 0);
103
104 void spawn_close_pid(Pid pid);                             
105
106 /** @} group Spawn */
107
108 } // namespace Glib
109