Fix possible issue with iteration variable changing
This commit is contained in:
parent
32778cf9fd
commit
2e53f92179
2 changed files with 3 additions and 3 deletions
|
@ -222,8 +222,8 @@ return function(promise)
|
||||||
|
|
||||||
local waiters = {}
|
local waiters = {}
|
||||||
for i=1,#speciesSlice,1 do
|
for i=1,#speciesSlice,1 do
|
||||||
|
local outputPipe = _M.poppets[i].output
|
||||||
local waiter = util.promiseWrap(function()
|
local waiter = util.promiseWrap(function()
|
||||||
local outputPipe = _M.poppets[i].output
|
|
||||||
local line = outputPipe:read("*l")
|
local line = outputPipe:read("*l")
|
||||||
|
|
||||||
print("Started receiving output from child process "..i)
|
print("Started receiving output from child process "..i)
|
||||||
|
|
4
util.lua
4
util.lua
|
@ -12,9 +12,9 @@ _M.isWin = package.config:sub(1, 1) == '\\'
|
||||||
--- Useful for decoupling code from the original event it was fired in.
|
--- Useful for decoupling code from the original event it was fired in.
|
||||||
---@param next function The function to resolve on the next tick
|
---@param next function The function to resolve on the next tick
|
||||||
---@return Promise Promise A promise that returns the value of the next function
|
---@return Promise Promise A promise that returns the value of the next function
|
||||||
function _M.promiseWrap(next)
|
function _M.promiseWrap(next, value)
|
||||||
local promise = Promise.new()
|
local promise = Promise.new()
|
||||||
promise:resolve()
|
promise:resolve(value)
|
||||||
return promise:next(next)
|
return promise:next(next)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue