diff options
author | Lucas Beyer <lucasb.eyer.be@gmail.com> | 2015-12-07 19:45:55 +0300 |
---|---|---|
committer | Lucas Beyer <lucasb.eyer.be@gmail.com> | 2015-12-07 19:45:55 +0300 |
commit | 3c6b32c29a29e4837690e8ec9d445b0d4933dcc7 (patch) | |
tree | c2b895752a3239739de00cc93f660efc13529c07 | |
parent | 0aff06c7b3ba291c86fd9e861258e56397885be5 (diff) |
Allow quitting with double Ctrl+D
I'm used to this feature from IPython/Jupyter and since here you also quit on empty string, I see no harm?
Without this change, doing double Ctrl+D would get:
```
th> Do you really want to exit ([y]/n)? /home.local/lucas/inst/src/torch/install/bin/luajit: ...ucas/inst/src/torch/install/share/lua/5.1/trepl/init.lua:587: attempt to index local 'line' (a nil value)
stack traceback:
...ucas/inst/src/torch/install/share/lua/5.1/trepl/init.lua:587: in function 'repl'
.../src/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk
[C]: at 0x00406670
```
-rw-r--r-- | init.lua | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -584,7 +584,7 @@ function repl() if not line or line == 'exit' then io.write('Do you really want to exit ([y]/n)? ') io.flush() local line = io.read('*l') - if line == '' or line:lower() == 'y' then + if not line or line == '' or line:lower() == 'y' then os.exit() end end |