diff options
| author | ruki <[email protected]> | 2017-05-04 10:22:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-04 10:22:02 +0800 |
| commit | 31de28277a4ed502cc544a9481c2128b592e3d60 (patch) | |
| tree | 181bed59d0269712aa08583c4fcf74b19901860e /core/src | |
| parent | 8be20cf25d130505f43953334899a54ef2d43c6f (diff) | |
quit multi-line input
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/sandbox/interactive.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/xmake/sandbox/interactive.c b/core/src/xmake/sandbox/interactive.c index 7019781a4..c3c706abb 100644 --- a/core/src/xmake/sandbox/interactive.c +++ b/core/src/xmake/sandbox/interactive.c @@ -253,13 +253,21 @@ static tb_int_t xm_sandbox_loadline(lua_State *lua, tb_int_t top) */ status = luaL_loadbuffer(lua, lua_tostring(lua, -1), lua_strlen(lua, -1), "=stdin"); - // complete?? + // complete? if (!xm_sandbox_incomplete(lua, status)) break; // get more input if (!xm_sandbox_pushline(lua)) return -1; + // cancel multi-line input? + if (!tb_strcmp(lua_tostring(lua, -1), "q")) + { + lua_pop(lua, 2); + lua_pushstring(lua, "return "); + continue ; + } + /* add a new line * * stack: arg1 scriptbuffer scriptfunc scriptbuffer "\n"(top) -> ... |
