Skip to content

Commit 296971b

Browse files
committed
Add popen_handle:wait() parameter and new errors
Since version 3.2.0 the popen_handle:wait() method has one more parameter and may raise two more errors: Param timeout Error TimedOut Error ChannelIsClosed
1 parent af67953 commit 296971b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doc/reference/reference_lua/popen.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,26 @@ Below is a list of all ``popen`` functions and handle methods.
760760
``status`` component of the table returned by
761761
:ref:`popen_handle:info() <popen-info>`).
762762

763+
Since version 3.2.0 the *popen_handle:*wait() method has one more parameter and may raise two more errors:
764+
* :param **timeout**, in seconds. The parameter defines the period for the mwthod to wait for a resolution.
765+
* error TimedOut. The error means that the method has not reached the positive result but has reached defined **timeout**.
766+
* error ChannelIsClosed. The error is returned when the target popen handle is closed from another fiber.
767+
768+
**Timeout parameter example**
769+
770+
(on Tarantool console)
771+
772+
.. code-block:: lua
773+
774+
local ph = popen.new(<...>)
775+
local res, err = ph:wait({timeout = 1})
776+
777+
if res == nil then
778+
-- Timeout is reached.
779+
assert(err.type == 'TimedOut')
780+
<...>
781+
end
782+
763783
.. _popen-close:
764784

765785
.. method:: close()

0 commit comments

Comments
 (0)