-í
ç¶<c       s^     d  Z    d d d g Z ! d „  Z * d „  Z 2 d „  Z ? d „  Z K d „  Z d	 S(
   s-  Execute shell commands via os.popen() and return status, output.

Interface summary:

       import commands

       outtext = commands.getoutput(cmd)
       (exitstatus, outtext) = commands.getstatusoutput(cmd)
       outtext = commands.getstatus(file)  # returns output of "ls -ld file"

A trailing newline is removed from the output string.

Encapsulates the basic operation:

      pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
      text = pipe.read()
      sts = pipe.close()

 [Note:  it would be nice to add functions to interpret the exit status.]
s   getstatusoutputs	   getoutputs	   getstatusc    s!   ! " # t  d t |  ƒ ƒ Sd S(   s-   Return output of "ls -ld <file>" in a string.s   ls -ldN(   s	   getoutputs   mkargs   file(   s   file(    (    s   /usr/lib/python2.2/commands.pys	   getstatus! s   c    s   * + , t  |  ƒ d Sd S(   s=   Return output (stdout or stderr) of executing cmd in a shell.i   N(   s   getstatusoutputs   cmd(   s   cmd(    (    s   /usr/lib/python2.2/commands.pys	   getoutput* s   c    s    2 3 4 d k  } 5 | i d |  d d ƒ } 6 | i ƒ  } 7 | i ƒ  } 8 | t j o 8 d } n 9 | d d j o 9 | d  } n : | | f Sd S(   s4   Return (status, output) of executing cmd in a shell.Ns   { s   ; } 2>&1s   ri    iÿÿÿÿs   
(	   s   oss   popens   cmds   pipes   reads   texts   closes   stss   None(   s   cmds   pipes   stss   texts   os(    (    s   /usr/lib/python2.2/commands.pys   getstatusoutput2 s     c    s/   ? @ d  k  } A t | i i |  | ƒ ƒ Sd  S(   N(   s   oss   mkargs   paths   joins   heads   x(   s   heads   xs   os(    (    s   /usr/lib/python2.2/commands.pys   mk2arg? s   c    sŒ   K L d |  j o M d |  d Sn N d } O x? |  DO ]4 } P | d j o Q | d } n R | | } q9 WS | d } T | Sd  S(   Ns   's    's    "s   \$"`s   \s   "(   s   xs   ss   c(   s   xs   ss   c(    (    s   /usr/lib/python2.2/commands.pys   mkargK s   	
 	N(   s   __doc__s   __all__s	   getstatuss	   getoutputs   getstatusoutputs   mk2args   mkarg(   s   mk2args	   getoutputs   mkargs   __all__s   getstatusoutputs	   getstatus(    (    s   /usr/lib/python2.2/commands.pys   ? s   	