Re: [Chicken-users] Reading from STDIN with the hang

2014-04-01 Thread Christian Kellermann
Hi Alexej,

* Alexej Magura sickha...@gmail.com [140331 23:24]:
 K, so I???m currently working on an application that, if the user doesn???t 
 provide any options/operands, reads from STDIN, like GNU cat.  I just 
 finished adding signal-handling for SIGINT (Ctrl-c), however, now whenever I 
 press Ctrl-c nothing happens because (read-char) hangs until I press enter.  
 Is there a way to use (read-char) that won???t make it hang?  Maybe something 
 like: (if (not-null? (peek-char)) (read-char))?  I saw that (char-ready?) is 
 supposed to prevent the next call to (read-char) from hanging, but (while 
 I???m sure that (char-ready?) in fact works) I can???t seem to get it to 
 work.  
 
 Anyone have any experience with this kind of issue; would using (read-line) 
 instead of (read-char) make a positive difference?  (I doubt it would)

Is this compiled code or interpreted code? If it is run in the
interpreter it might be that some module you load snatches sigint
from you. Parley is one of the candidates and maybe I should change
that behaviour. You can instantly try this by running your csi with
the (-n) switch which will prevent loading anything from .csirc.

Kind regards,

Christian

-- 
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Reading from STDIN with the hang

2014-03-31 Thread Alexej Magura
K, so I’m currently working on an application that, if the user doesn’t provide 
any options/operands, reads from STDIN, like GNU cat.  I just finished adding 
signal-handling for SIGINT (Ctrl-c), however, now whenever I press Ctrl-c 
nothing happens because (read-char) hangs until I press enter.  Is there a way 
to use (read-char) that won’t make it hang?  Maybe something like: (if 
(not-null? (peek-char)) (read-char))?  I saw that (char-ready?) is supposed to 
prevent the next call to (read-char) from hanging, but (while I’m sure that 
(char-ready?) in fact works) I can’t seem to get it to work.  

Anyone have any experience with this kind of issue; would using (read-line) 
instead of (read-char) make a positive difference?  (I doubt it would)
-- 
Alexej Magura
Sent with Airmail___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users