mirror of https://github.com/flaggo/pydu.git
fix func name error in cmd doc
This commit is contained in:
parent
9141d67b2a
commit
4d9897512d
14
docs/cmd.rst
14
docs/cmd.rst
|
@ -1,18 +1,18 @@
|
||||||
Cmd
|
Cmd
|
||||||
-------
|
-------
|
||||||
|
|
||||||
.. py:function:: pydu.cmd.execute(cmd, wait=True, shell=True)
|
.. py:function:: pydu.cmd.run(cmd, wait=True, shell=True)
|
||||||
|
|
||||||
Execute cmd based on ``subprocess.Popen``.
|
Run cmd based on ``subprocess.Popen``.
|
||||||
If ``wait`` is True, ``execute`` will return the tuple of ``(returncode, stdout)``.
|
If ``wait`` is True, ``run`` will return the tuple of ``(returncode, stdout)``.
|
||||||
Note, ``stderr`` is redirected to ``stdout``. If ``wait`` is False, ``execute``
|
Note, ``stderr`` is redirected to ``stdout``. If ``wait`` is False, ``run``
|
||||||
will return object of ``Popen``.
|
will return object of ``Popen``.
|
||||||
``shell`` is same to parameter of ``Popen``.
|
``shell`` is same to parameter of ``Popen``.
|
||||||
|
|
||||||
>>> from pydu.cmd import execute
|
>>> from pydu.cmd import run
|
||||||
>>> execute('echo hello')
|
>>> run('echo hello')
|
||||||
(0, b'hello\r\n') # Python 3
|
(0, b'hello\r\n') # Python 3
|
||||||
>>> execute('echo hello', wait=False)
|
>>> run('echo hello', wait=False)
|
||||||
<subprocess.Popen at 0x22e4010f9e8>
|
<subprocess.Popen at 0x22e4010f9e8>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue