1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Process</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class Process</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Processes<br />
<b>Header:</b> Poco/Process.h</p>
<h2>Description</h2>
<div class="description">
<p>This class provides methods for working with processes. </p>
</div>
<h2>Inheritance</h2>
<p><b>Direct Base Classes: </b>ProcessImpl</p>
<p><b>All Base Classes: </b>ProcessImpl</p>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Process.html#9527" title="Poco::Process::id()">id</a>, <a href="Poco.Process.html#9542" title="Poco::Process::kill()">kill</a>, <a href="Poco.Process.html#9531" title="Poco::Process::launch()">launch</a>, <a href="Poco.Process.html#9544" title="Poco::Process::requestTermination()">requestTermination</a>, <a href="Poco.Process.html#9528" title="Poco::Process::times()">times</a>, <a href="Poco.Process.html#9540" title="Poco::Process::wait()">wait</a></p>
<h2>Types</h2>
<h3><a name="9526">Args</a></h3>
<p class="decl">typedef ArgsImpl <a href="Poco.Process.html#9526" title="Poco::Process::Args">Args</a>;</p>
<div class="description">
<p></p>
</div>
<h3><a name="9525">PID</a></h3>
<p class="decl">typedef PIDImpl <a href="Poco.Process.html#9525" title="Poco::Process::PID">PID</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Member Functions</h2>
<h3><a name="9527">id</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.Process.html#9525" title="Poco::Process::PID">PID</a> id();</p>
<div class="description">
<p>Returns the process ID of the current process. </p>
</div>
<h3><a name="9542">kill</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void kill(<br /> <a href="Poco.Process.html#9525" title="Poco::Process::PID">PID</a> pid<br />);</p>
<div class="description">
<p>Kills the process with the given pid. </p>
</div>
<h3><a name="9531">launch</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.ProcessHandle.html" title="class Poco::ProcessHandle">ProcessHandle</a> launch(<br /> const std::string & command,<br /> const <a href="Poco.Process.html#9526" title="Poco::Process::Args">Args</a> & args<br />);</p>
<div class="description">
<p>Creates a new process for the given command and returns a <a href="Poco.ProcessHandle.html" title="class Poco::ProcessHandle">ProcessHandle</a> of the new process. The given arguments are passed to the command on the command line. </p>
</div>
<h3><a name="9534">launch</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.ProcessHandle.html" title="class Poco::ProcessHandle">ProcessHandle</a> launch(<br /> const std::string & command,<br /> const <a href="Poco.Process.html#9526" title="Poco::Process::Args">Args</a> & args,<br /> <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> * inPipe,<br /> <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> * outPipe,<br /> <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> * errPipe<br />);</p>
<div class="description">
<p>Creates a new process for the given command and returns a <a href="Poco.ProcessHandle.html" title="class Poco::ProcessHandle">ProcessHandle</a> of the new process. The given arguments are passed to the command on the command line. </p>
<p>If inPipe, outPipe or errPipe is non-null, the corresponding standard input, standard output or standard error stream of the launched process is redirected to the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. <a href="Poco.PipeInputStream.html" title="class Poco::PipeInputStream">PipeInputStream</a> or <a href="Poco.PipeOutputStream.html" title="class Poco::PipeOutputStream">PipeOutputStream</a> can be used to send receive data from, or send data to the process. </p>
<p>Note: the same <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> can be used for both outPipe and errPipe. </p>
<p>After a <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> has been passed as inPipe, only write operations are valid. After a <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> has been passed as outPipe or errPipe, only read operations are valid. </p>
<p>It is forbidden to pass the same pipe as inPipe and outPipe or errPipe. </p>
<p>Usage example: </p>
<pre>Pipe outPipe;
Process::Args args;
ProcessHandle ph(launch("/bin/ps", args, 0, &outPipe, 0));
PipeInputStream istr(outPipe);
... // read output of ps from istr
int rc = ph.wait();
</pre>
</div>
<h3><a name="9544">requestTermination</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void requestTermination(<br /> <a href="Poco.Process.html#9525" title="Poco::Process::PID">PID</a> pid<br />);</p>
<div class="description">
<p>Requests termination of the process with the give <a href="Poco.Process.html#9525" title="Poco::Process::PID">PID</a>. </p>
<p>On Unix platforms, this will send a SIGINT to the process and thus work with arbitrary processes. </p>
<p>On other platforms, a global event flag will be set. Setting the flag will cause <a href="Poco.Util.ServerApplication.html#17209" title="Poco::Util::ServerApplication::waitForTerminationRequest()">Util::ServerApplication::waitForTerminationRequest</a>() to return. Therefore this will only work with applications based on <a href="Poco.Util.ServerApplication.html" title="class Poco::Util::ServerApplication">Util::ServerApplication</a>. </p>
</div>
<h3><a name="9528">times</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static void times(<br /> long & userTime,<br /> long & kernelTime<br />);</p>
<div class="description">
<p>Returns the number of seconds spent by the current process in user and kernel mode. </p>
</div>
<h3><a name="9540">wait</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static int wait(<br /> const <a href="Poco.ProcessHandle.html" title="class Poco::ProcessHandle">ProcessHandle</a> & handle<br />);</p>
<div class="description">
<p>Waits for the process specified by handle to terminate and returns the exit code of the process. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|