Re: guix shell readline issue with R

2023-07-03 Thread Kyle Andrews


Edouard Klein  writes:

> Here is a script that restores the ctrl-C behaviour of R, whithin a guix 
> shell.
>
> I must admit I don't exactly understand the finer points of why it works, but 
> just trapping SIGINT in the script is enough for R to behave.
>
> My intuition is SIGINT is sent to the whole group. The script
> interrupts R. If we trap it in the script, it does nothing. R gets it as well 
> and acts on it like you expect.

Thanks, Edouard!

Your script worked perfectly just as you described. I was sorely missing that 
`set -m' call and passing true from the bash function. I also really like your 
idea for the shebang line.

Best Regards,
Kyle




Re: guix shell readline issue with R

2023-07-03 Thread Edouard Klein
Hy Kyle,


Here is a script that restores the ctrl-C behaviour of R, whithin a guix
shell.

I must admit I don't exactly understand the finer points of why it
works, but just trapping SIGINT in the script is enough for R to behave.

My intuition is SIGINT is sent to the whole group. The script interrupts
R. If we trap it in the script, it does nothing. R gets it as well and
acts on it like you expect.

Let me know if the problem still persists.

Here is the script:

#!/usr/bin/env -S guix shell r -- bash
set -m
R&
function ctrlc(){
# Doing nothing
true
}
trap ctrlc SIGINT
fg

Cheers,

Edouard.


Kyle Andrews  writes:

> Edouard Klein  writes:
>
>> Hi Kyle,
>>
>>
>> Running
>> guix shell r
>>
>> and then
>> R
>>
>> will get you the C-c handling you want.
>
> Hi Edouard,
>
> I wrote another reply, but forgot to comment on this because I feel like I am 
> missing something here.
>
> It would be really convenient if I could just write a shell script like that.
> For me the first command hijacks the execution so that the script cannot 
> invoke
> R. Is there a workaround avoiding -- which would let me automate that with a
> script?
>
> Cheers,
> Kyle