Mercurial Hosting > luan
comparison src/luan/tools/web_shell.luan @ 152:a9391f914aba
minor fix
git-svn-id: https://luan-java.googlecode.com/svn/trunk@153 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 16 Jun 2014 10:50:40 +0000 |
parents | f4ce03ff6b2f |
children |
comparison
equal
deleted
inserted
replaced
151:c9100f29fae0 | 152:a9391f914aba |
---|---|
1 import "Http" | 1 import "Http" |
2 | 2 |
3 per_session = true | 3 per_session = true |
4 | 4 |
5 local history = {} | 5 local history = {} |
6 local env = {} | |
6 | 7 |
7 Io.stdout = {} | 8 Io.stdout = {} |
8 function Io.stdout.write(...) | 9 function Io.stdout.write(...) |
9 for _,v in Basic.values(...) do | 10 for _,v in Basic.values(...) do |
10 history[#history+1] = v | 11 history[#history+1] = v |
17 else | 18 else |
18 local cmd = Http.request.get_parameter("cmd") | 19 local cmd = Http.request.get_parameter("cmd") |
19 if cmd ~= nil then | 20 if cmd ~= nil then |
20 print( "% "..cmd ) | 21 print( "% "..cmd ) |
21 try | 22 try |
22 local line = load(cmd,"<web_shell>",true,true); | 23 local line = load(cmd,"<web_shell>",env,true); |
23 Debug.print_if_something( line() ) | 24 Debug.print_if_something( line() ) |
24 catch e do | 25 catch e do |
25 Io.print_to(Io.stderr,e) | 26 Io.print_to(Io.stderr,e) |
26 print(e) | 27 print(e) |
27 end | 28 end |