bug584124, r=shu: njs terminal annoyances

This commit is contained in:
Dave Herman 2010-08-09 14:39:01 -07:00
Родитель ab3014f1b0
Коммит 9349d7a799
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -1118,9 +1118,14 @@ Narcissus.interpreter = (function() {
x.run(function() {
for (;;) {
x.result = undefined;
putstr("njs> ");
var line = readline();
x.result = undefined;
// If readline receives EOF it returns null.
if (line === null) {
print("");
break;
}
try {
execute(parser.parse(b, line, "stdin", 1), x);
display(x.result);

Просмотреть файл

@ -4,7 +4,7 @@
# Expects to be in the same directory as ./js
# Expects the Narcissus src files to be in ./narcissus/
import os, re, sys
import os, re, sys, signal
from subprocess import *
from optparse import OptionParser
@ -18,6 +18,12 @@ narc_jslex = os.path.join(NARC_JS_DIR, "jslex.js")
narc_jsparse = os.path.join(NARC_JS_DIR, "jsparse.js")
narc_jsexec = os.path.join(NARC_JS_DIR, "jsexec.js")
def handler(signum, frame):
print ''
# the exit code produced by ./js on SIGINT
sys.exit(130)
signal.signal(signal.SIGINT, handler)
if __name__ == '__main__':
op = OptionParser(usage='%prog [TEST-SPECS]')