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]