237 lines
5.8 KiB
HTML
237 lines
5.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Dpkg::IPC</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Dpkg::IPC</H1>
|
|
Section: libdpkg-perl (3perl)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Dpkg::IPC - helper functions for IPC
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
Dpkg::IPC offers helper functions to allow you to execute
|
|
other programs in an easy, yet flexible way, while hiding
|
|
all the gory details of <FONT SIZE="-1">IPC</FONT> (Inter-Process Communication)
|
|
from you.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>FUNCTIONS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">$pid = spawn(%opts)<DD>
|
|
|
|
|
|
|
|
|
|
Creates a child process and executes another program in it.
|
|
The arguments are interpreted as a hash of options, specifying
|
|
how to handle the in and output of the program to execute.
|
|
Returns the pid of the child process (unless the wait_child
|
|
option was given).
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Any error will cause the function to exit with one of the
|
|
Dpkg::ErrorHandling functions.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Options:
|
|
<DL COMPACT><DT id="2"><DD>
|
|
<DL COMPACT>
|
|
<DT id="3">exec<DD>
|
|
|
|
|
|
Can be either a scalar, i.e. the name of the program to be
|
|
executed, or an array reference, i.e. the name of the program
|
|
plus additional arguments. Note that the program will never be
|
|
executed via the shell, so you can't specify additional arguments
|
|
in the scalar string and you can't use any shell facilities like
|
|
globbing.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Mandatory Option.
|
|
<DT id="4">from_file, to_file, error_to_file<DD>
|
|
|
|
|
|
Filename as scalar. Standard input/output/error of the
|
|
child process will be redirected to the file specified.
|
|
<DT id="5">from_handle, to_handle, error_to_handle<DD>
|
|
|
|
|
|
Filehandle. Standard input/output/error of the child process will be
|
|
dup'ed from the handle.
|
|
<DT id="6">from_pipe, to_pipe, error_to_pipe<DD>
|
|
|
|
|
|
Scalar reference or object based on IO::Handle. A pipe will be opened for
|
|
each of the two options and either the reading (<TT>"to_pipe"</TT> and
|
|
<TT>"error_to_pipe"</TT>) or the writing end (<TT>"from_pipe"</TT>) will be returned in
|
|
the referenced scalar. Standard input/output/error of the child process
|
|
will be dup'ed to the other ends of the pipes.
|
|
<DT id="7">from_string, to_string, error_to_string<DD>
|
|
|
|
|
|
Scalar reference. Standard input/output/error of the child
|
|
process will be redirected to the string given as reference. Note
|
|
that it wouldn't be strictly necessary to use a scalar reference
|
|
for <TT>"from_string"</TT>, as the string is not modified in any way. This was
|
|
chosen only for reasons of symmetry with <TT>"to_string"</TT> and
|
|
<TT>"error_to_string"</TT>. <TT>"to_string"</TT> and <TT>"error_to_string"</TT> imply the
|
|
<TT>"wait_child"</TT> option.
|
|
<DT id="8">wait_child<DD>
|
|
|
|
|
|
Scalar. If containing a true value, <B>wait_child()</B> will be called before
|
|
returning. The return value of <B>spawn()</B> will be a true value, not the pid.
|
|
<DT id="9">nocheck<DD>
|
|
|
|
|
|
Scalar. Option of the <B>wait_child()</B> call.
|
|
<DT id="10">timeout<DD>
|
|
|
|
|
|
Scalar. Option of the <B>wait_child()</B> call.
|
|
<DT id="11">chdir<DD>
|
|
|
|
|
|
Scalar. The child process will chdir in the indicated directory before
|
|
calling exec.
|
|
<DT id="12">env<DD>
|
|
|
|
|
|
Hash reference. The child process will populate <TT>%ENV</TT> with the items of the
|
|
hash before calling exec. This allows exporting environment variables.
|
|
<DT id="13">delete_env<DD>
|
|
|
|
|
|
Array reference. The child process will remove all environment variables
|
|
listed in the array before calling exec.
|
|
<DT id="14">sig<DD>
|
|
|
|
|
|
Hash reference. The child process will populate <TT>%SIG</TT> with the items of the
|
|
hash before calling exec. This allows setting signal dispositions.
|
|
<DT id="15">delete_sig<DD>
|
|
|
|
|
|
Array reference. The child process will reset all signals listed in the
|
|
array to their default dispositions before calling exec.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="16"><DD>
|
|
</DL>
|
|
|
|
<DT id="17">wait_child($pid, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Takes as first argument the pid of the process to wait for.
|
|
Remaining arguments are taken as a hash of options. Returns
|
|
nothing. Fails if the child has been ended by a signal or
|
|
if it exited non-zero.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Options:
|
|
<DL COMPACT><DT id="18"><DD>
|
|
<DL COMPACT>
|
|
<DT id="19">cmdline<DD>
|
|
|
|
|
|
String to identify the child process in error messages.
|
|
Defaults to ``child process''.
|
|
<DT id="20">nocheck<DD>
|
|
|
|
|
|
If true do not check the return status of the child (and thus
|
|
do not fail it has been killed or if it exited with a
|
|
non-zero return code).
|
|
<DT id="21">timeout<DD>
|
|
|
|
|
|
Set a maximum time to wait for the process, after that kill the process and
|
|
fail with an error message.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="22"><DD>
|
|
</DL>
|
|
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>CHANGES</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Version 1.02 (dpkg 1.18.0)</H3>
|
|
|
|
|
|
|
|
Change options: <B>wait_child()</B> now kills the process when reaching the 'timeout'.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Version 1.01 (dpkg 1.17.11)</H3>
|
|
|
|
|
|
|
|
New options: <B>spawn()</B> now accepts 'sig' and 'delete_sig'.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Version 1.00 (dpkg 1.15.6)</H3>
|
|
|
|
|
|
|
|
Mark the module as public.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Dpkg, Dpkg::ErrorHandling
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="23"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="24"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="25"><A HREF="#lbAD">FUNCTIONS</A><DD>
|
|
<DT id="26"><A HREF="#lbAE">CHANGES</A><DD>
|
|
<DL>
|
|
<DT id="27"><A HREF="#lbAF">Version 1.02 (dpkg 1.18.0)</A><DD>
|
|
<DT id="28"><A HREF="#lbAG">Version 1.01 (dpkg 1.17.11)</A><DD>
|
|
<DT id="29"><A HREF="#lbAH">Version 1.00 (dpkg 1.15.6)</A><DD>
|
|
</DL>
|
|
<DT id="30"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:39 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|