newLISP Fan Club

Forum => newLISP in the real world => Topic started by: newdep on August 22, 2006, 12:53:12 PM

Title: [BUG?] command-line
Post by: newdep on August 22, 2006, 12:53:12 PM
Hi Lutz,



release 8.9.3



I could only verify this on Debian, OS/2 and WinXP,

but if I use (command-line nil) im also unable to use (exit)

(oke i know that ctrl-c doesnot work, that a feature ;-)



But the only way to break it is by ctrl- (QUIT signal) and not by (exit)





Also the CPU boosts towards the 99% a nice full-loop...!





This has previously never been the case...I.R.C. ?





Norman.
Title:
Post by: Lutz on August 22, 2006, 01:41:44 PM
(command-line nil) is for shutting down the command line, so you woud nevr use it in the interactive console, shutting yourself out. When doing this in an interactive console it will bypass the readline() for the command line not accept your (exit) or other keystrokes and enter a tight loop, this make the CPU load going up.



You should use (coomand-line nil) only in scripts to suppress the user from breaking out, like this:


#!/usr/bin/newlisp

(command-line nil)
(dotimes (i 30)
(sleep 1000)
(println i))
(exit)


this program would print the numbers 0 to 29 and not allow you to interrupt it, then it would exit. A newLISP (read-line) in such a program would still be observed and wait for user input.



Lutz
Title:
Post by: newdep on August 22, 2006, 01:51:26 PM
pfff ...yes your right... It has been a long time since i used (command-line)...

My mistake!