Skip to content

Commit f740f43

Browse files
authored
Remove incorrect error and add new option
* Remove incorrect OutOfMemory error * Add new inherit_fds option description to popen.new Fixes #3608 Fixes #3609
1 parent b5a0723 commit f740f43

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

doc/reference/reference_lua/popen.rst

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,19 @@ Below is a list of all ``popen`` functions and handle methods.
165165

166166
(if failure) ``nil, err``
167167

168-
Possible raised errors are:
168+
Possible raised errors:
169169

170-
* IllegalParams: incorrect type or value of a parameter
171-
* IllegalParams: group signal is set, while setsid is not
170+
* ``IllegalParams``: incorrect type or value of a parameter
171+
* ``IllegalParams``: group signal is set, while setsid is not
172172

173-
Possible error reasons when ``nil, err`` is returned are:
173+
Possible error reasons when ``nil, err`` is returned:
174174

175-
* SystemError: dup(), fcntl(), pipe(), vfork() or close() fails in the
175+
* ``SystemError``: dup(), fcntl(), pipe(), vfork() or close() fails in the
176176
parent process
177-
* SystemError: (temporary restriction) the parent process has closed stdin,
177+
* ``SystemError``: (temporary restriction) the parent process has closed stdin,
178178
stdout or stderr
179-
* OutOfMemory: unable to allocate the handle or a temporary buffer
180179

181-
Possible ``opts`` items are:
180+
Possible ``opts`` items:
182181

183182
* ``opts.stdin`` (action on STDIN_FILENO)
184183
* ``opts.stdout`` (action on STDOUT_FILENO)
@@ -252,14 +251,17 @@ Below is a list of all ``popen`` functions and handle methods.
252251
| | | or when Lua GC collects the handle. |
253252
+----------------------+----------------+-------------------------------------------+
254253

255-
256254
The returned ``ph`` handle provides a
257255
:ref:`popen_handle:close() <popen-close>` method for explicitly
258256
releasing all occupied resources, including the child process
259257
itself if ``opts.keep_child`` is not set). However, if the ``close()``
260258
method is not called for a handle during its lifetime, the
261259
Lua GC will trigger the same freeing actions.
262260

261+
Since version 3.2.0, the ``inherit.fds`` option is added to the ``opts``
262+
table. The option allows define file descriptor numbers that should be
263+
left open in the child process if the ``close_fds`` flag is set to ``true``.
264+
263265
Tarantool recommends using ``opts.setsid`` plus ``opts.group_signal``
264266
if a child process may spawn its own children and if they should all
265267
be killed together.
@@ -397,7 +399,7 @@ Below is a list of all ``popen`` functions and handle methods.
397399
:ref:`popen.shell() <popen-shell>`
398400
:param table opts: options
399401

400-
Possible ``opts`` items are:
402+
Possible ``opts`` items:
401403

402404
* ``opts.stdout`` (boolean, default ``true``, if ``true`` then read from stdout)
403405
* ``opts.stderr`` (boolean, default ``false``, if ``true`` then read from stderr)
@@ -415,19 +417,18 @@ Below is a list of all ``popen`` functions and handle methods.
415417

416418
These errors are raised on incorrect parameters or when the fiber is cancelled:
417419

418-
* IllegalParams: incorrect type or value of a parameter
419-
* IllegalParams: called on a closed handle
420-
* IllegalParams: opts.stdout and opts.stderr are both set
421-
* IllegalParams: a requested IO operation is not supported by
420+
* ``IllegalParams``: incorrect type or value of a parameter
421+
* ``IllegalParams``: called on a closed handle
422+
* ``IllegalParams``: opts.stdout and opts.stderr are both set
423+
* ``IllegalParams``: a requested IO operation is not supported by
422424
the handle (stdout / stderr is not piped)
423-
* IllegalParams: attempt to operate on a closed file descriptor
424-
* FiberIsCancelled: cancelled by external code
425+
* ``IllegalParams``: attempt to operate on a closed file descriptor
426+
* ``FiberIsCancelled``: cancelled by external code
425427

426428
``nil, err`` is returned on following failures:
427429

428430
* SocketError: an IO error occurs at read()
429431
* TimedOut: exceeded the opts.timeout quota
430-
* OutOfMemory: no memory space for a buffer to read into
431432
* LuajitError: ("not enough memory"): no memory space for the Lua string
432433

433434
.. _popen-write:

0 commit comments

Comments
 (0)