IRC channel logs

2022-08-09.log

back to list of logs

<daviid>Hy! https://hylang.org/
<dsmith-work>Oooo!
<dsmith-work>Oh that would have been wonderful to have when I doing lots of Python a few years ago.
<dsmith-work>A block scoping let. Yey!
<dsmith-work>Almost make me want to cry
***civodul` is now known as civodul
***chimp_ is now known as Psybur
<daviid>dsmith-work: you could still install and play with it though ...
*daviid just installed hy, aptitude install python3-pip, then pip3 install --user hy
<daviid>dsmith-work: debian-next informs me python3-hy is in unstable, soon in testing ... fwiw
<daviid>sneek: seen stis
<sneek>I think I remember stis in #guile 24 days ago, saying: o/.
<daviid>didn't know this https://github.com/koji-kojiro/guile-python
<daviid>procrastinating, i rarely use python :), but if ihave, hy is so much better
<daviid>sneek: later tell stis how about hy-on-guile, next to your python-on-guile projects - https://hylang.org/
<sneek>Okay.
***berndj-blackout is now known as berndj
<dsmith>sneek: botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been running for 50 seconds
<sneek>This system has been up 1 minute
<dsmith>Thunderstorms
***regtur_ is now known as regtur
***taw10_ is now known as taw10
<tohoyn>sneek: botsnack
<sneek>:)
<dsmith-work>sneek: botsnack
<sneek>:)
<dsmith-work>Tuesday Greetings, Guilers
<dthompson>howdy
<troydm>hi all, how do I stop Guile process? I've tried (quit) from inside a function which is executed when signal is caught but I get
<troydm>uncaught throw to quit: ()
<unmatched-paren>troydm: (exit <CODE>)
<troydm>uncaught throw to quit: (0)
<troydm>I think quit is alias for exit
<troydm>this is called from inside a thread which is created using (make-thread call
<troydm>or rather I'm catch a signal via C routine, which calls Guile which kinda needs to stop process which it does not
<troydm>also would be nice to be able to run some code before guile exits when I press Ctrl-D or Ctrl-C when in REPL or typing (quit) from REPL
<troydm>typing (quit) from REPL btw works fine
***Noisytoot_ is now known as Noisytoot
<tohoyn>troydm: any use for Guile procedure kill?
<troydm>tohoyn: what does it do?
<tohoyn>troydm: see https://www.gnu.org/software/guile/manual/html_node/Signals.html
<tohoyn>it sends a signal to a process
<tohoyn>and the signal may be SIGINT
<tohoyn>you can use getpid to find out the current process id
<troydm>I still don't get why uncaught throw is happening when I call (quit) indirectly
<tohoyn>troydm: see file ice-9/boot-9.scm, the relevant defitions at https://paste.debian.net/1249828/
<tohoyn>^module/ice-9/boot-9.scm in the Guile sources
<tohoyn>^definitions
<troydm>hmm, ic
<tohoyn>troydm: you could also take a look at procedure primitive-exit
<troydm>I think I might handle signal handling via Guile and then call terminating code, this way it will work in general
<troydm>any examples how to catch SIGTERM?
<troydm>and SIGINT
<dsmith-work>troydm: https://mail.gnu.org/archive/html/guile-user/2019-05/msg00066.html
<tohoyn>troydm: for SIGPROF: https://git.savannah.gnu.org/cgit/guile.git/tree/module/statprof.scm
<troydm>hmm, actually primitive-exit kinda works but there is only one problem, terminfo is messed up
<troydm>maybe because I'm using (activate-readline) when starting REPL
<troydm>I need to throw 'quit in REPL's thread, that way it would work
<troydm>but I'm not quite sure how this is possible
<troydm>are there no ways to signal scheme's repl to stop?
<troydm>maybe even outside of Guile?
<troydm>like via C API
<troydm>I start it via scm_shell(argc, argv); call
<troydm>well I could literally call C's exit via hooking some C procedure to Guile and then calling it
<troydm>but that is not something that I would like to do
<troydm>yup, activate-readline is culprit of primitive-exit messing terminal state
<tohoyn>troydm: see also "man pthread-exit"
<tohoyn>I'm going sleeping now
<dsmith-work>Doesn't (quit) just do a throw?
***karlosz_ is now known as karlosz
<troydm>dsmith-work: it does, but in my case I'm calling a quit from a thread which is not a main REPL thread and this unfortunately does nothing
<troydm>except
<troydm>printing in REPL console
<troydm> │24.| #Nix / NixOS
<troydm>uncaught throw to quit: ()
<dsmith-work>Ahh
<troydm>and I'm not sure how to stop guile, primitive-exit messes terminal settings because I use (activate-readline)
<troydm>without using readline it works fine, but I need readline
<dsmith-work>Ya, becuse no cleanup to put them back to "normal"
<troydm>yeah, exactly
<troydm>as I'm not familiar with Guile, my question still remains if there is no other way to cleanly stop Guile process from another thread which is not main REPL
<dsmith-work>Seems like readline should install some kind of atexit handler. Oh, but primitive-exit might be C _exit() ?
<troydm>I've checked readline module's code and there is only one exit-hook lambda which just writes history file and clears it
<troydm>which is probably not what restores stty settings back to normal
*dsmith-work looks
<troydm>probably readline library itself adds somekind of a hook to _exit or something I don't know
<dsmith-work>Ya, that's what I'm thinking
<troydm>because if I exit a process with primitive-exit, stty's echo is disabled which is probably due to readline handling echo internally
<troydm>also I'm looking at scm_shell source code and I don't see how this handles REPL, I don't see any loops
<troydm>exit (scm_exit_status (scm_eval_x (scm_compile_shell_switches (argc, argv), ┊scm_current_module ())));¬
<dsmith-work>module/ice-9/top-repl.scm
<troydm>ahh, ic
<troydm>rl_cleanup_after_signal
<troydm>it seems
<dsmith-work>YEs, that looks promising
<troydm>which is called from unwind_readline
<troydm>scm_dynwind_unwind_handler
<troydm>what is this?
<troydm>some kind of mechanism to call function on unwinding built into Guile?
<troydm>it would have been nice to have some kind of deactive readline function that would disable readline, that would have solved the issue
<troydm>well, it seems like unwind_readline is registered as dynamic unwind handler via scm_dynwind_unwind_handler and since when quiting via primitive-exit no unwinding takes place the stty doesn't getts restored
<troydm>this is generally the issue because there is no graceful way to shutdown Guile REPL from another thread or even from and another REPL (like the one over remote tcp)