You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it is convenient to perform a substraction like deadline - now() and pass the resulting value as a timeout. I would expect the following semantic: if timeout <= 0 then perform an action if it is ready-to-go (would not trigger EWOULDBLOCK and fiber yield). Otherwise, return a timeout error.
popen now interprets any negative timeout value as an error.
It is definitely not a bug, rather a feature request (semantic change even).
We also didn't come to a resolution how it should behave in this case - it's not clear should a popen call fails with a timeout if it takes longer than proposed timeout to execute. Say, popen.new('...', {timeout=0})
@sergos OK, let's call it a feature. I don't care much in this case.
popen.new() has no timeout and it possibly shouldn't. I want to clarify that we're talking about calls that wait for some externally produced event: for example, arriving data from another process.
Let's take :read() as an example.
If the call has zero timeout (or a negative timeout), it should return immediately, where it means don't wait for an external event. It is OK to do some (relatively) fast local work like a buffer copying.
Let's assume the data is already there and the call can return immediately with the new data or report a timeout error. In this case, it should return the data.
In other works, zero/negative timeout means "don't wait for data arriving" in this case.
Similarly, it means "don't wait for a free space in the pipe buffer" for :write().
And, finally, it means "don't wait for the process termination" for :wait() (buf it is OK to send a zero signal and look on its result).
Sometimes it is convenient to perform a substraction like
deadline - now()
and pass the resulting value as a timeout. I would expect the following semantic: iftimeout <= 0
then perform an action if it is ready-to-go (would not trigger EWOULDBLOCK and fiber yield). Otherwise, return a timeout error.popen
now interprets any negativetimeout
value as an error.tarantool/src/lua/popen.c
Lines 285 to 297 in 927e351
tarantool/src/lua/popen.c
Lines 1743 to 1745 in 927e351
The list of affected methods:
The text was updated successfully, but these errors were encountered: