Update version according to OSCI-883
[packages/precise/mcollective.git] / doc / classes / MCollective / Shell.html
diff --git a/doc/classes/MCollective/Shell.html b/doc/classes/MCollective/Shell.html
deleted file mode 100644 (file)
index 31bc5a3..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!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" xml:lang="en" lang="en">
-<head>
-  <title>Class: MCollective::Shell</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-  <meta http-equiv="Content-Script-Type" content="text/javascript" />
-  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
-  <script type="text/javascript">
-  // <![CDATA[
-
-  function popupCode( url ) {
-    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
-  }
-
-  function toggleCode( id ) {
-    if ( document.getElementById )
-      elem = document.getElementById( id );
-    else if ( document.all )
-      elem = eval( "document.all." + id );
-    else
-      return false;
-
-    elemStyle = elem.style;
-    
-    if ( elemStyle.display != "block" ) {
-      elemStyle.display = "block"
-    } else {
-      elemStyle.display = "none"
-    }
-
-    return true;
-  }
-  
-  // Make codeblocks hidden by default
-  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-  
-  // ]]>
-  </script>
-
-</head>
-<body>
-
-
-
-    <div id="classHeader">
-        <table class="header-table">
-        <tr class="top-aligned-row">
-          <td><strong>Class</strong></td>
-          <td class="class-name-in-header">MCollective::Shell</td>
-        </tr>
-        <tr class="top-aligned-row">
-            <td><strong>In:</strong></td>
-            <td>
-                <a href="../../files/lib/mcollective/shell_rb.html">
-                lib/mcollective/shell.rb
-                </a>
-        <br />
-            </td>
-        </tr>
-
-        <tr class="top-aligned-row">
-            <td><strong>Parent:</strong></td>
-            <td>
-                Object
-            </td>
-        </tr>
-        </table>
-    </div>
-  <!-- banner header -->
-
-  <div id="bodyContent">
-
-
-
-  <div id="contextContent">
-
-    <div id="description">
-      <p>
-Wrapper around systemu that handles executing of system commands in a way
-that makes stdout, stderr and status available. Supports timeouts and sets
-a default sane environment.
-</p>
-<pre>
-  s = Shell.new(&quot;date&quot;, opts)
-  s.runcommand
-  puts s.stdout
-  puts s.stderr
-  puts s.status.exitstatus
-</pre>
-<p>
-Options hash can have:
-</p>
-<pre>
-  cwd         - the working directory the command will be run from
-  stdin       - a string that will be sent to stdin of the program
-  stdout      - a variable that will receive stdout, must support &lt;&lt;
-  stderr      - a variable that will receive stdin, must support &lt;&lt;
-  environment - the shell environment, defaults to include LC_ALL=C
-                set to nil to clear the environment even of LC_ALL
-</pre>
-
-    </div>
-
-
-   </div>
-
-    <div id="method-list">
-      <h3 class="section-bar">Methods</h3>
-
-      <div class="name-list">
-      <a href="#M000371">new</a>&nbsp;&nbsp;
-      <a href="#M000372">runcommand</a>&nbsp;&nbsp;
-      </div>
-    </div>
-
-  </div>
-
-
-    <!-- if includes -->
-
-    <div id="section">
-
-
-
-
-
-    <div id="attribute-list">
-      <h3 class="section-bar">Attributes</h3>
-
-      <div class="name-list">
-        <table>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">command</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">cwd</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">environment</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">status</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">stderr</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">stdin</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        <tr class="top-aligned-row context-row">
-          <td class="context-item-name">stdout</td>
-          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
-          <td class="context-item-desc"></td>
-        </tr>
-        </table>
-      </div>
-    </div>
-      
-
-
-    <!-- if method_list -->
-    <div id="methods">
-      <h3 class="section-bar">Public Class methods</h3>
-
-      <div id="method-M000371" class="method-detail">
-        <a name="M000371"></a>
-
-        <div class="method-heading">
-          <a href="#M000371" class="method-signature">
-          <span class="method-name">new</span><span class="method-args">(command, options={})</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000371-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000371-source">
-<pre>
-    <span class="ruby-comment cmt"># File lib/mcollective/shell.rb, line 24</span>
-24:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">options</span>={})
-25:       <span class="ruby-ivar">@environment</span> = {<span class="ruby-value str">&quot;LC_ALL&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;C&quot;</span>}
-26:       <span class="ruby-ivar">@command</span> = <span class="ruby-identifier">command</span>
-27:       <span class="ruby-ivar">@status</span> = <span class="ruby-keyword kw">nil</span>
-28:       <span class="ruby-ivar">@stdout</span> = <span class="ruby-value str">&quot;&quot;</span>
-29:       <span class="ruby-ivar">@stderr</span> = <span class="ruby-value str">&quot;&quot;</span>
-30:       <span class="ruby-ivar">@stdin</span> = <span class="ruby-keyword kw">nil</span>
-31:       <span class="ruby-ivar">@cwd</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">tmpdir</span>
-32: 
-33:       <span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opt</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
-34:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">opt</span>.<span class="ruby-identifier">to_s</span>
-35:           <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;stdout&quot;</span>
-36:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;stdout should support &lt;&lt;&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;&lt;&lt;&quot;</span>)
-37:             <span class="ruby-ivar">@stdout</span> = <span class="ruby-identifier">val</span>
-38: 
-39:           <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;stderr&quot;</span>
-40:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;stderr should support &lt;&lt;&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">&quot;&lt;&lt;&quot;</span>)
-41:             <span class="ruby-ivar">@stderr</span> = <span class="ruby-identifier">val</span>
-42: 
-43:           <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;stdin&quot;</span>
-44:             <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;stdin should be a String&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
-45:             <span class="ruby-ivar">@stdin</span> = <span class="ruby-identifier">val</span>
-46: 
-47:           <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;cwd&quot;</span>
-48:             <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Directory #{val} does not exist&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">val</span>)
-49:             <span class="ruby-ivar">@cwd</span> = <span class="ruby-identifier">val</span>
-50: 
-51:           <span class="ruby-keyword kw">when</span> <span class="ruby-value str">&quot;environment&quot;</span>
-52:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">nil?</span>
-53:               <span class="ruby-ivar">@environment</span> = {}
-54:             <span class="ruby-keyword kw">else</span>
-55:               <span class="ruby-ivar">@environment</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">dup</span>)
-56:             <span class="ruby-keyword kw">end</span>
-57:         <span class="ruby-keyword kw">end</span>
-58:       <span class="ruby-keyword kw">end</span>
-59:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-      <h3 class="section-bar">Public Instance methods</h3>
-
-      <div id="method-M000372" class="method-detail">
-        <a name="M000372"></a>
-
-        <div class="method-heading">
-          <a href="#M000372" class="method-signature">
-          <span class="method-name">runcommand</span><span class="method-args">()</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p>
-Actually does the systemu call passing in the correct environment, stdout
-and stderr
-</p>
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000372-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000372-source">
-<pre>
-    <span class="ruby-comment cmt"># File lib/mcollective/shell.rb, line 62</span>
-62:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">runcommand</span>
-63:       <span class="ruby-identifier">opts</span> = {<span class="ruby-value str">&quot;env&quot;</span>    =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@environment</span>,
-64:               <span class="ruby-value str">&quot;stdout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@stdout</span>,
-65:               <span class="ruby-value str">&quot;stderr&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@stderr</span>,
-66:               <span class="ruby-value str">&quot;cwd&quot;</span>    =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@cwd</span>}
-67: 
-68:       <span class="ruby-identifier">opts</span>[<span class="ruby-value str">&quot;stdin&quot;</span>] = <span class="ruby-ivar">@stdin</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@stdin</span>
-69: 
-70:       <span class="ruby-comment cmt"># Check if the parent thread is alive. If it should die,</span>
-71:       <span class="ruby-comment cmt"># and the process spawned by systemu is still alive,</span>
-72:       <span class="ruby-comment cmt"># fire off a blocking waitpid and wait for the process to</span>
-73:       <span class="ruby-comment cmt"># finish so that we can avoid zombies.</span>
-74:       <span class="ruby-identifier">thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>
-75:       <span class="ruby-ivar">@status</span> = <span class="ruby-identifier">systemu</span>(<span class="ruby-ivar">@command</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cid</span><span class="ruby-operator">|</span>
-76:         <span class="ruby-keyword kw">begin</span>
-77:           <span class="ruby-keyword kw">while</span>(<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">alive?</span>)
-78:             <span class="ruby-identifier">sleep</span> <span class="ruby-value">0</span><span class="ruby-value">.1</span>
-79:           <span class="ruby-keyword kw">end</span>
-80: 
-81:           <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">cid</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Process</span>.<span class="ruby-identifier">getpgid</span>(<span class="ruby-identifier">cid</span>)
-82:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span>
-83:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ESRCH</span>
-84:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECHILD</span>
-85:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
-86:           <span class="ruby-constant">Log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Unexpected exception received while waiting for child process: #{e.class}: #{e}&quot;</span>)
-87:         <span class="ruby-keyword kw">end</span>
-88:       <span class="ruby-keyword kw">end</span>
-89:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-
-    </div>
-
-
-  </div>
-
-
-<div id="validator-badges">
-  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
\ No newline at end of file