johnjaye has quit [Read error: Connection reset by peer]
johnjaye has joined #ruby
jmcgnh has quit [Ping timeout: 252 seconds]
peebs has quit [Quit: Konversation terminated!]
jmcgnh has joined #ruby
Vonter has quit [Ping timeout: 276 seconds]
brokkoli_origin has quit [Ping timeout: 252 seconds]
brokkoli_origin has joined #ruby
Vonter has joined #ruby
brokkoli_originl has joined #ruby
brokkoli_originl has quit [Client Quit]
Gestahlt has joined #ruby
<Gestahlt>
Hi! I am getting desperate a bit - Im trying to create for my API a shell runner used for pipelines and such. I use Open3.popen3 to execute shell commands. I kinda understand how it works, but what baffles me is following - I run popen3 with the cmd arg /bin/bash (or whatever is defined as interpreter) - Then i use stdin.puts to send commands to
<Gestahlt>
that interpreter (at least i hope it is like that). All works, i can read stdout/stderr and exit code depending on what and how i do it. Now where i am stuck is when i send for example "sleep 300 &" - I would expect that sleep 300 is executed in the background and the next command comes immediatly - it doesnt. It just sleeps for 300 and does not
<Gestahlt>
execute the following command. Any idea why?
<leftylink>
hmm. it does seem to background for me and immediately execute the following command, so I guess my setup differs from yours in some way. wonder what way that could be
<leftylink>
and e.g. if I issue 'jobs' I can see the backgrounded sleep
<Gestahlt>
Hm, im also contemplating. Im currently considering if its because of my read for stdout/stderr.
<Gestahlt>
but reading the stdout/stderr should not block at the sleep in the bg
<Gestahlt>
It should block the "parent" thread - thats what i expect actually (So it never gets into a finished state), but thats okay and expected.
<leftylink>
to show my work of what I thought worked as expected on my machine: https://termbin.com/bprf
gemmaro_ has joined #ruby
<leftylink>
for me it immediately prints the two strings and "[1] + Running" indicating the backgrounded sleep
<leftylink>
and if I understand the problem description correctly, on the problematic machine, instead it will not print the second string (or it will sleep before doing so, something like that)
cappy has left #ruby [Leaving]
<Gestahlt>
Something like that. But you showed me something good where i was not sure - puts does produce an result immediatly. Thats good to know
<Gestahlt>
Okay funky - when i try to get the stdout immediatly (myarray << stdout.readline) it blocks - even without the bg
<Gestahlt>
I try to run the same thing in irb
<Gestahlt>
yea works fine there
<Gestahlt>
hrrrrm
<Gestahlt>
but what i dont see, is the /bin/sh process
<Gestahlt>
on the OS
<Gestahlt>
i wonder why
<Gestahlt>
Aaah
<Gestahlt>
because it exited - the bg process is spawned outside of the current shell. That makes the issue only weirder
<Gestahlt>
Maybe Sinatra is interfering?
<Gestahlt>
Hm i guess it has something to do with Sinatra - Since it works fine in a simple ruby script, on irb i guess something is happening in that context. I also tested the tty-command gem - and its the same issue
mtm has quit [Ping timeout: 276 seconds]
mtm has joined #ruby
<Gestahlt>
Okay i think i got it
<Gestahlt>
Its indeed related to Sinatra or app servers in general
<Gestahlt>
i think i need to spawn a worker for this kind of stuff
<Gestahlt>
What would be your recommendation? Fibers, Thread or Ractors?
Starfoxxes has joined #ruby
crivic has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
crivic has quit [Quit: crivic was here]
brokkoli_origin has joined #ruby
xuochi has joined #ruby
xuochi has quit [Client Quit]
<adam12>
Gestahlt: Suckerpunch maybe? I didn't see what you needed exactly.
sadome has joined #ruby
sadome has joined #ruby
sadome has quit [Changing host]
sadome has quit [Excess Flood]
<adam12>
You could just spin up a new Thread and see if that helps. Thread.new do ...yourcode... end
Tempesta has quit [Read error: Connection reset by peer]
Tempesta has joined #ruby
Tempesta has quit [Changing host]
Tempesta has joined #ruby
sadome has joined #ruby
sadome has quit [Excess Flood]
sadome has joined #ruby
sadome has quit [Excess Flood]
Tempesta has quit [Read error: Connection reset by peer]
polishdub has quit [Quit: leaving]
user71 has joined #ruby
desnudopenguino has joined #ruby
polishdub has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
desnudopenguino has quit [Ping timeout: 252 seconds]
c10l2 has joined #ruby
c10l has quit [Ping timeout: 248 seconds]
c10l2 is now known as c10l
Gestahlt has quit [Quit: Client closed]
peebs has joined #ruby
brokkoli_origin has quit [Ping timeout: 264 seconds]