aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvs12024-10-19 20:38:28 +1000
committerdvs12024-10-19 20:38:28 +1000
commit6b923cc70451a8483700023119746289f705548d (patch)
tree36c1d84b6f9fb6942d9bc8eda2207c7945029a13
parentAdd users script for post JACK setup, like starting music stuff. (diff)
downloadJackOnAllDevices-6b923cc70451a8483700023119746289f705548d.zip
JackOnAllDevices-6b923cc70451a8483700023119746289f705548d.tar.gz
JackOnAllDevices-6b923cc70451a8483700023119746289f705548d.tar.bz2
JackOnAllDevices-6b923cc70451a8483700023119746289f705548d.tar.xz
Make APT.exe status return more robust.
Lua sucks at this.
Diffstat (limited to '')
-rwxr-xr-xaataaj.lua22
1 files changed, 10 insertions, 12 deletions
diff --git a/aataaj.lua b/aataaj.lua
index 5cc9423..d5b081e 100755
--- a/aataaj.lua
+++ b/aataaj.lua
@@ -159,24 +159,22 @@ APT.exe = function(c)
159 I'm getting 7168 or 0. No idea what the fuck that is. 159 I'm getting 7168 or 0. No idea what the fuck that is.
160 local ok, rslt, status = os.execute(s) 160 local ok, rslt, status = os.execute(s)
161 ]] 161 ]]
162 local f = APT.readCmd(self.cmd, 'r') 162 local f = APT.readCmd(self.cmd .. '; echo "$?"', 'r')
163 -- The last line will be the command's returned status, collect everything else in result. 163 -- The last line will be the command's returned status, collect everything else in result.
164 self.status = '' -- Otherwise the result starts with 0. 164 self.status = tonumber(f[#f])
165 f[#f] = nil
165 self.result = '\n' 166 self.result = '\n'
166 self.lines = f 167 self.lines = f
167 for i,l in ipairs(f) do 168 for i,l in ipairs(f) do
168 self.result = self.result .. l .. "\n" 169 self.result = self.result .. l .. "\n"
169 end 170 end
170 f = APT.readCmd('echo "$?"', 'r') 171 if (137 == self.status) or (124 == self.status) then
171 for i,l in ipairs(f) do 172 print("timeout killed " .. self.status .. ' ' .. self.command)
172 self.status = tonumber(l) 173 print('ERROR ' .. "timeout killed " .. self.status .. ' ' .. self.command)
173 if (137 == self.status) or (124 == self.status) then 174 elseif (nil == self.status) then
174 print("timeout killed " .. self.status .. ' ' .. self.command) 175 print("STATUS |" .. "NIL" .. '| ' .. self.command)
175 E("timeout killed " .. self.status .. ' ' .. self.command) 176 elseif (0 ~= self.status) then
176 elseif (0 ~= self.status) then 177 print("STATUS |" .. self.status .. '| ' .. self.command)
177 print("status |" .. self.status .. '| ' .. self.command)
178 E("status |" .. self.status .. '| ' .. self.command)
179 end
180 end 178 end
181 return self 179 return self
182 end 180 end