1Dpkg::IPC(3perl)                 libdpkg-perl                 Dpkg::IPC(3perl)
2
3
4

NAME

6       Dpkg::IPC - helper functions for IPC
7

DESCRIPTION

9       Dpkg::IPC offers helper functions to allow you to execute other
10       programs in an easy, yet flexible way, while hiding all the gory
11       details of IPC (Inter-Process Communication) from you.
12

FUNCTIONS

14       $pid = spawn(%opts)
15           Creates a child process and executes another program in it.  The
16           arguments are interpreted as a hash of options, specifying how to
17           handle the in and output of the program to execute.  Returns the
18           pid of the child process (unless the wait_child option was given).
19
20           Any error will cause the function to exit with one of the
21           Dpkg::ErrorHandling functions.
22
23           Options:
24
25           exec
26               Can be either a scalar, i.e. the name of the program to be
27               executed, or an array reference, i.e. the name of the program
28               plus additional arguments. Note that the program will never be
29               executed via the shell, so you can't specify additional
30               arguments in the scalar string and you can't use any shell
31               facilities like globbing.
32
33               Mandatory Option.
34
35           from_file, to_file, error_to_file
36               Filename as scalar. Standard input/output/error of the child
37               process will be redirected to the file specified.
38
39           from_handle, to_handle, error_to_handle
40               Filehandle. Standard input/output/error of the child process
41               will be dup'ed from the handle.
42
43           from_pipe, to_pipe, error_to_pipe
44               Scalar reference or object based on IO::Handle. A pipe will be
45               opened for each of the two options and either the reading
46               ("to_pipe" and "error_to_pipe") or the writing end
47               ("from_pipe") will be returned in the referenced scalar.
48               Standard input/output/error of the child process will be dup'ed
49               to the other ends of the pipes.
50
51           from_string, to_string, error_to_string
52               Scalar reference. Standard input/output/error of the child
53               process will be redirected to the string given as reference.
54               Note that it wouldn't be strictly necessary to use a scalar
55               reference for "from_string", as the string is not modified in
56               any way. This was chosen only for reasons of symmetry with
57               "to_string" and "error_to_string". "to_string" and
58               "error_to_string" imply the "wait_child" option.
59
60           wait_child
61               Scalar. If containing a true value, wait_child() will be called
62               before returning. The return value of spawn() will be a true
63               value, not the pid.
64
65           nocheck
66               Scalar. Option of the wait_child() call.
67
68           timeout
69               Scalar. Option of the wait_child() call.
70
71           chdir
72               Scalar. The child process will chdir in the indicated directory
73               before calling exec.
74
75           env Hash reference. The child process will populate %ENV with the
76               items of the hash before calling exec. This allows exporting
77               environment variables.
78
79           delete_env
80               Array reference. The child process will remove all environment
81               variables listed in the array before calling exec.
82
83           sig Hash reference. The child process will populate %SIG with the
84               items of the hash before calling exec. This allows setting
85               signal dispositions.
86
87           delete_sig
88               Array reference. The child process will reset all signals
89               listed in the array to their default dispositions before
90               calling exec.
91
92       wait_child($pid, %opts)
93           Takes as first argument the pid of the process to wait for.
94           Remaining arguments are taken as a hash of options. Returns
95           nothing. Fails if the child has been ended by a signal or if it
96           exited non-zero.
97
98           Options:
99
100           cmdline
101               String to identify the child process in error messages.
102               Defaults to "child process".
103
104           nocheck
105               If true do not check the return status of the child (and thus
106               do not fail it has been killed or if it exited with a non-zero
107               return code).
108
109           timeout
110               Set a maximum time to wait for the process, after that kill the
111               process and fail with an error message.
112

CHANGES

114   Version 1.02 (dpkg 1.18.0)
115       Change options: wait_child() now kills the process when reaching the
116       'timeout'.
117
118   Version 1.01 (dpkg 1.17.11)
119       New options: spawn() now accepts 'sig' and 'delete_sig'.
120
121   Version 1.00 (dpkg 1.15.6)
122       Mark the module as public.
123

SEE ALSO

125       Dpkg, Dpkg::ErrorHandling
126
127
128
1291.21.8                            2022-06-05                  Dpkg::IPC(3perl)
Impressum