Mercurial Hosting > luan
diff src/luan/modules/http/tools/Shell.luan @ 1520:d9a5405a3102
try statement
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 21 Jun 2020 18:14:13 -0600 |
parents | 1604d7f36f3a |
children | d3e61cd2aca0 |
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Shell.luan Fri Jun 19 20:10:47 2020 -0600 +++ b/src/luan/modules/http/tools/Shell.luan Sun Jun 21 18:14:13 2020 -0600 @@ -2,7 +2,6 @@ local error = Luan.error local load = Luan.load or error() local to_string = Luan.to_string or error() -local try = Luan.try or error() local range = Luan.range or error() local Table = require "luan:Table.luan" local concat = Table.concat or error() @@ -33,24 +32,16 @@ local fns = {} function fns.run(cmd) - return try { - function() - local line - try { - function() - line = load("return "..cmd,"<web_shell>",env) - end - catch = function(e) - line = load(cmd,"<web_shell>",env) - end - } - return line() + try + try + return load("return "..cmd,"<web_shell>",env) + catch e + return load(cmd,"<web_shell>",env) end - catch = function(e) --- Io.print_to(Io.stderr,e) - return to_string(e) - end - } + catch e +-- Io.print_to(Io.stderr,e) + return to_string(e) + end end local timeout = Time.period{hours=10}