1 | assert(bash_start, "Sorry: Need privileges. (e.g.: run -power 208)") |
2 | |
3 | bash_start() |
4 | bash_send('date\n') |
5 | --bash_send('date\n') |
6 | bash_send('exit\n') |
7 | |
8 | for i=1, 10 do |
9 | os_sleep(500) |
10 | local alive = bash_alive() |
11 | out, err = unpack(bash_poll()) |
12 | |
13 | -- print err first so bash output looks prettier. |
14 | if err ~= '' then print(err) end |
15 | if out ~= '' then print(out) end |
16 | if not alive then break end |
17 | end |
18 | |
19 | if bash_alive() then bash_kill() end |
20 | return 'ok' |
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
473 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { assert(bash_start, "Sorry: Need privileges. (e.g.: run -power 208)") bash_start() bash_send('date\n') --bash_send('date\n') bash_send('exit\n') for i=1, 10 do os_sleep(500) local alive = bash_alive() out, err = unpack(bash_poll()) -- print err first so bash output looks prettier. if err ~= '' then print(err) end if out ~= '' then print(out) end if not alive then break end end if bash_alive() then bash_kill() end return 'ok' }} | 2015-08-18 16:39:16 | delete |
471 | #1000604 (pitcher) | 2015-08-20 15:28:24 |
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 468 | [visualize] |
Snippet ID: | #208 |
Snippet name: | BASH access test |
Eternal ID of this version: | #208/1 |
Text MD5: | b2af831c8d62b2a384cf08d59cb0dc19 |
Author: | stefan |
Category: | |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-01-25 16:13:39 |
Source code size: | 468 bytes / 20 lines |
Pitched / IR pitched: | Yes / Yes |
Views / Downloads: | 1600 / 285 |
Referenced in: | [show references] |