I thought popen does not give us the exit code of the process it ran
If you don’t know what an exit code is for a process then please read about it under process concepts.
I thought it did not allow this, but I was wrong!
This apparently works:
-- This will open the file
local P = io.popen('ls')
-- This will read all of the output, as always
local Output = file:read('*all')
local ReturnCode = {P:close()}Apparently :close for process will return the same values as os.execute. Kind of makes sense really.