Skip to content

Updades description of the popen module #5117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: latest
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions doc/reference/reference_lua/popen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ object:
syscall
* :ref:`popen.new <popen-new>` to create a popen object with more specific options

Either function returns a handle which we will call ``popen_handle`` or ``ph``.
With the handle one can execute methods.

===============================================================================
Index
===============================================================================

Below is a list of all ``popen`` functions and handle methods.

.. container:: table
Expand Down Expand Up @@ -87,6 +80,10 @@ Below is a list of all ``popen`` functions and handle methods.
| <popen-handle_fields>` | |
+--------------------------------------+---------------------------------+

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
popen module constructors
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. _popen-shell:

.. function:: shell(command [, mode])
Expand All @@ -95,8 +92,7 @@ Below is a list of all ``popen`` functions and handle methods.

:param string command: a command to run, mandatory
:param string mode: communication mode, optional
:return: (if success) a popen handle, which we will call
``popen_handle`` or ``ph``
:return: (if success) a popen handle object

(if failure) ``nil, err``

Expand Down Expand Up @@ -160,8 +156,7 @@ Below is a list of all ``popen`` functions and handle methods.
mandatory; absolute path to the program is required when
``opts.shell`` is false (default)
:param table opts: table of options, optional
:return: (if success) a popen handle, which we will call
``popen_handle`` or ``ph``
:return: (if success) a popen handle object

(if failure) ``nil, err``

Expand Down Expand Up @@ -251,7 +246,7 @@ Below is a list of all ``popen`` functions and handle methods.
| | | or when Lua GC collects the handle. |
+----------------------+----------------+-------------------------------------------+

The returned ``ph`` handle provides a
The returned ``popen_handle`` handle provides a
:ref:`popen_handle:close() <popen-close>` method for explicitly
releasing all occupied resources, including the child process
itself if ``opts.keep_child`` is not set). However, if the ``close()``
Expand Down Expand Up @@ -394,7 +389,7 @@ Below is a list of all ``popen`` functions and handle methods.

Read data from a child peer.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:param table opts: options
Expand Down Expand Up @@ -437,7 +432,7 @@ Below is a list of all ``popen`` functions and handle methods.

Write string ``str`` to stdin stream of a child process.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:param string str: string to write
Expand Down Expand Up @@ -480,7 +475,7 @@ Below is a list of all ``popen`` functions and handle methods.

Close parent's ends of std* fds.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:param table opts: options
Expand Down Expand Up @@ -535,7 +530,7 @@ Below is a list of all ``popen`` functions and handle methods.

Send SIGTERM signal to a child process.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:return: see :ref:`popen_handle:signal() <popen-signal>` for errors and
Expand All @@ -551,7 +546,7 @@ Below is a list of all ``popen`` functions and handle methods.

Send SIGKILL signal to a child process.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:return: see :ref:`popen_handle:signal() <popen-signal>` for errors and
Expand All @@ -568,7 +563,7 @@ Below is a list of all ``popen`` functions and handle methods.

Send signal to a child process.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:param number signo: signal to send
Expand Down Expand Up @@ -611,7 +606,7 @@ Below is a list of all ``popen`` functions and handle methods.

Return information about the popen handle.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:return: (if success) formatted result
Expand Down Expand Up @@ -743,7 +738,7 @@ Below is a list of all ``popen`` functions and handle methods.

Wait until a child process gets exited or signaled.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:param number timeout: since version :doc:`3.2.0 </release/3.2.0>`. The parameter defines the period in seconds for the method to wait for a resolution. The default value is "infinity".
Expand Down Expand Up @@ -785,7 +780,7 @@ Below is a list of all ``popen`` functions and handle methods.

Close a popen handle.

:param handle ph: handle of a child process created with
:param userdata ph: handle of a child process created with
:ref:`popen.new() <popen-new>` or
:ref:`popen.shell() <popen-shell>`
:return: (if success) true
Expand Down Expand Up @@ -835,6 +830,10 @@ Below is a list of all ``popen`` functions and handle methods.
means success for a caller. The return values are purely
informational: they are for logging or some kind of reporting.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
popen handle fields
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. _popen-handle_fields:

**Handle fields**
Expand All @@ -851,6 +850,10 @@ Below is a list of all ``popen`` functions and handle methods.

See :ref:`popen_handle:info() <popen-info>` for details.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
popen module constants
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. _popen-constants:

**Module constants**
Expand Down