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:
parent
4e0369e7d2
commit
79b3e2822c
10
disknet.lua
10
disknet.lua
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user