1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-08-03 20:33:47 +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()
local good, goddamnit = pcall(function()
while true do
for i = 1, #fList do
contents = fList[i].readAll()
@ -199,6 +200,7 @@ disknet.receive = function(channel)
for i = 1, #fList do
fList[i].close()
end
fList, pList = {}, {}
break
end
end
@ -212,12 +214,20 @@ disknet.receive = function(channel)
os.pullEvent("")
end
end
end)
if good then
if contents then
return output.message, output.channel, output.id, output.time
else
return nil
end
else
for i = 1, #fList do
fList[i].close()
end
error(goddamnit, 0)
end
else
error(grr)
end