1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-06-17 17:54:04 +00:00

Ensure that channel files are closed if terminated

This commit is contained in:
LDDestroier 2019-05-02 11:13:42 -04:00 committed by GitHub
parent 4e0369e7d2
commit 79b3e2822c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,6 +159,7 @@ disknet.receive = function(channel)
loadFList() loadFList()
local good, goddamnit = pcall(function()
while true do while true do
for i = 1, #fList do for i = 1, #fList do
contents = fList[i].readAll() contents = fList[i].readAll()
@ -199,6 +200,7 @@ disknet.receive = function(channel)
for i = 1, #fList do for i = 1, #fList do
fList[i].close() fList[i].close()
end end
fList, pList = {}, {}
break break
end end
end end
@ -212,12 +214,20 @@ disknet.receive = function(channel)
os.pullEvent("") os.pullEvent("")
end end
end end
end)
if good then
if contents then if contents then
return output.message, output.channel, output.id, output.time return output.message, output.channel, output.id, output.time
else else
return nil return nil
end end
else
for i = 1, #fList do
fList[i].close()
end
error(goddamnit, 0)
end
else else
error(grr) error(grr)
end end