havenwood changed the topic of #ruby to: Ruby 3.4.3, 3.3.8 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
fercell has quit [Quit: ZNC - https://znc.in]
fercell has joined #ruby
jhass has quit [Remote host closed the connection]
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
Guest44 has joined #ruby
Guest44 has quit [Client Quit]
fantazo has joined #ruby
ih8u has quit [Remote host closed the connection]
Furai has quit [Quit: WeeChat 4.6.2]
Furai has joined #ruby
jhass has joined #ruby
schne1der has joined #ruby
niv has quit [Quit: ZNC - https://znc.in]
niv has joined #ruby
niv has quit [Client Quit]
niv has joined #ruby
niv has quit [Client Quit]
niv has joined #ruby
cybniv has joined #ruby
niv has quit [Read error: Connection reset by peer]
_whitelogger has joined #ruby
_whitelogger has joined #ruby
grenierm has joined #ruby
_whitelogger has joined #ruby
dionysus69 has joined #ruby
user71 has joined #ruby
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
kerzhak has quit [Client Quit]
kerzhak has joined #ruby
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 248 seconds]
rvalue- is now known as rvalue
marc_in_space has quit [Ping timeout: 268 seconds]
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
wbooze has quit [Quit: Leaving]
grenierm has quit [Ping timeout: 240 seconds]
<depesz> hi. i have program that does sleep(), and I want the sleep() to end when I'll send USR1 signal. I can do Signal.trap(), and it is being processed, but after signal handler, it just goes back to sleep. how can I make it stop sleeping ?
<kjetilho> use select to sleep instead? (non-Pythonista graybeard talking)
<depesz> [].select ?
<depesz> not sure i follow. care to point me to doc/example ?
<kjetilho> select.select((), (), (), 3.14) will sleep for 3.14 seconds
<depesz> select': wrong number of arguments (given 0, expected 1..4) (ArgumentError)
<kjetilho> you did import select first?
<depesz> cannot load such file -- select (LoadError)
<kjetilho> not on Unix?
<depesz> duckduckgo-ing ruby select shows just shows array thing.
<depesz> well, on linux.
<depesz> sorry, i can't really stand unix.
<depesz> too used to gnu extensiosn.
<kjetilho> whaaa - why did I think I was in #python?
<kjetilho> sorry!
<depesz> that explains the confusion :)
<kjetilho> in Ruby it is IO.select
<depesz> thanks.
<kjetilho> yep, seems to work the same: IO.select([],[],[], 3.14)
wbooze has joined #ruby
jhass has quit [Remote host closed the connection]
jhass has joined #ruby
gemmaro_ has quit [Ping timeout: 252 seconds]
Tempesta has quit [Quit: See ya!]
gemmaro_ has joined #ruby
<o0x1eef> loop do
<o0x1eef> sleep 1
<o0x1eef> Process.kill 'SIGUSR1', Process.pid
<o0x1eef> rescue SignalException => ex
<o0x1eef> ex.signm == "SIGUSR1" ? break : retry
<o0x1eef> end
<o0x1eef> This is another way to do it
<o0x1eef> In your case there probably wouldn't be a sleep of 1, or Process.kill - but you get the idea. :)
GreenResponse has joined #ruby
Tempesta has joined #ruby
infinityfye has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
fantazo has quit [Quit: Lost terminal]
brokkoli_origin has joined #ruby
user71 has quit [Ping timeout: 248 seconds]
Vonter has quit [Ping timeout: 260 seconds]
Vonter has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
Vonter has quit [Ping timeout: 252 seconds]
user71 has joined #ruby
Vonter has joined #ruby
infinityfye has joined #ruby
cybniv has quit [Quit: ZNC - https://znc.in]
niv has joined #ruby
niv has quit [Client Quit]
niv has joined #ruby
niv has quit [Client Quit]
cybniv has joined #ruby
joako has quit [Ping timeout: 276 seconds]
ftajhii has quit [Ping timeout: 276 seconds]
joako has joined #ruby
eddof13 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
donofrio2 has quit [Ping timeout: 252 seconds]
donofrio has joined #ruby
donofrio2 has joined #ruby
donofrio has quit [Ping timeout: 265 seconds]
jmcantrell has joined #ruby
phenom has quit [Quit: Everyone has a plan until they get punched in the face. -Mike Tyson-]
phenom has joined #ruby
oznek has joined #ruby
levitating has joined #ruby
levitating has quit [Quit: Computer exploded]
infinityfye has quit [Read error: Connection reset by peer]
cappy has joined #ruby
user71 has quit [Quit: Leaving]
rvalue- has joined #ruby
rvalue has quit [Ping timeout: 272 seconds]
rvalue- is now known as rvalue
GreenResponse has quit [Quit: Leaving]
hightower2 has joined #ruby
casmajavi has joined #ruby
casmajavi has left #ruby [#ruby]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
<havenwood> A cool new thing we can do in Rubyland to say wait for a keypress is: $stdin.wait(IO::READABLE, 3.14)
<havenwood> require 'io/wait'
<havenwood> kjetilho: <3 select
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<o0x1eef> I don't know, that seems like a strange round about way to do it. The sleep system call man page specifically describes the scenario put forward by depesz - it is designed to put a thread to sleep and wait for a signal to interrupt it.
cappy has quit [Quit: Leaving]
kerzhak_ has joined #ruby
<o0x1eef> Woops, specifically here: https://man.openbsd.org/sleep.3
kerzhak has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
kerzhak_ is now known as kerzhak
ih8u has joined #ruby
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
eddof13 has quit [Quit: eddof13]
<o0x1eef> select, wait, etc - these are not really designed for that use-case. They're just underlying system calls that can produce EINTR like any other system call. But sleep is designed for this purpose. At least based on the info given.
<havenwood> o0x1eef: Ruby sleep doesn't respond to SIGALRM. Maybe it should?
<o0x1eef> It does here :)
<o0x1eef> ruby33 signaltest.rb
<o0x1eef> Alarm!
<o0x1eef> It most likely depends on the underlying OS
Milos has quit [Quit: ZNC 1.9.1 - https://znc.in]
Milos has joined #ruby