tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
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
L\¬Qc@sidZddlmZedddƒ[dddgZd    „Zd
„Zd „Zd „Zd „ZdS(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.]
iÿÿÿÿ(twarnpy3ksUthe commands module has been removed in Python 3.0; use the subprocess module insteadt
stacklevelitgetstatusoutputt    getoutputt    getstatuscCs3ddl}|jdtdƒtdt|ƒƒS(s-Return output of "ls -ld <file>" in a string.iÿÿÿÿNs"commands.getstatus() is deprecatedisls -ld(twarningstwarntDeprecationWarningRtmkarg(tfileR((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pyR%s cCst|ƒdS(s=Return output (stdout or stderr) of executing cmd in a shell.i(R(tcmd((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pyR0scCszddl}|jd|ddƒ}|jƒ}|jƒ}|dkrSd}n|ddkrp|d }n||fS(s4Return (status, output) of executing cmd in a shell.iÿÿÿÿNs{ s; } 2>&1tris
(tostpopentreadtclosetNone(R
R tpipettexttsts((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pyR8s        cCs%ddl}t|jj||ƒƒS(Niÿÿÿÿ(R Rtpathtjoin(theadtxR ((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pytmk2argEs cCs`d|krd|dSd}x1|D])}|dkrD|d}n||}q%W|d}|S(Ns's 's "s\$"`s\t"((Rtstc((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pyRQs     
N(    t__doc__RRt__all__RRRRR(((sP/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/commands.pyt<module>s