-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Labels
3.5Target is 3.5 and all newer release/master branchesTarget is 3.5 and all newer release/master branchesfeatureA new functionalityA new functionalitypopen
Description
All popen methods (except close) raise an IllegalParams error if the popen handle is closed:
tarantool> p = require('popen').new({'/bin/true'})
---
...
tarantool> p:close()
---
- true
...
tarantool> p:info()
---
- error: 'popen: attempt to operate on a closed handle'
...
tarantool> box.error.last():unpack()
---
- code: 0
base_type: IllegalParams
type: IllegalParams
message: 'popen: attempt to operate on a closed handle'
trace:
- file: builtin/box/console.lua
line: 429
...
This is inconvenient in case a popen handle is created and exported by another module, for example, tarantool/sideservice, which may close it asynchronously at any moment. Intercepting an IllegalParams error doesn't look right.
I see the following ways to make the popen module more user-friendly in this regard:
- Make
info()work even if the popen handle is closed. - Add a separate method that could be used for checking if a popen handle is closed.
- Raise a special error instead of
IllegalParamson an attempt to use a closed popen handle. Usage of a closed popen handle doesn't seem to be an illegal parameters issue anyway (all parameters are valid, the state isn't).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.5Target is 3.5 and all newer release/master branchesTarget is 3.5 and all newer release/master branchesfeatureA new functionalityA new functionalitypopen