Nowaker has quit [Remote host closed the connection]
grokify has joined #ruby
Nowaker has joined #ruby
bhaak has quit [Ping timeout: 260 seconds]
bhaak has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
D_A_N has joined #ruby
jpn_ has quit [Ping timeout: 246 seconds]
Na_Klar has joined #ruby
<Na_Klar>
Okay, I have a very complicated issue: I need to understand how executing code from "ruby --" is exactly different from calling "ruby file.rb". I have some bytecode which I load to the interpreter and that very weird issue appeared, that when I load the bytecode from a file X.rb, like "ruby X.rb", then this code runs fine. It all runs within a console and my code system()'s another program which writes to the framebuffer and then gets
<Na_Klar>
terminated; afterwared my console program is showed again. .. but: when I load the X.rb loader not directly but via "ruby -- < X.rb" it all works fine BUT that when the other program is called and writes to the framebuffer, it is not able to free the framebuffer again and its output is stuck over my console program. The only difference is just how I call the bytecode. "ruby X.rb" is fine "ruby -- < X.rb" is not. How can that even be??
<Na_Klar>
ah, forget the bytecode. Even when I call the script as script (not bytecode) with "ruby script.rb" it runs fine (the other program can free the framebuffer) but when I call it via "ruby -- < script.rb" the framebuffer is stuck. So, it is not related to bytecode at all. What can that be with "ruby --" that hinders a system call to free the framebuffer?
<Na_Klar>
I also have an error message from the program which gets called and is stuck: "can't manage access.nd / other processes can write to display / can't clean up". .. ofc this warnings do not appear when calling the script (which calls that error returning program) with "ruby script.rb".
<Na_Klar>
s/access.nd/access/
<wnd>
I'm guessing having Ruby read the script from stdin affects fd 0/1/2 of whatever you run from Ruby
<Na_Klar>
wnd: I guess you mean fb 0/1..?
<wnd>
stdin, stdout, stderr
<Na_Klar>
ah file descriptor .. but how is that related to the fb gets stuck?
<Na_Klar>
every other i/o operation works fine.
<wnd>
Too many unknowns (to me). Maybe the application calls fcntl and expects it to behave like true stdin.
TomyWork has joined #ruby
<wnd>
by true stdin I mean that of your terminal, or whatever it is
<Na_Klar>
wnd: the other program just reads a file from the disk and displays its contents. no user interaction.
<wnd>
all that I'm saying is that the fds of Ruby are probably set up differently between "ruby foo.rb" and "ruby <foo.rb", and that could make all the difference
<Na_Klar>
wnd: that could be ofc.
<wnd>
To be honest I don't know how an application gains access to the framebuffer, not to mention the application you use. For all I know, it could involve stdin/stdout to get some details like fb dimensions, and control its features.
<wnd>
ok sure, there might be /dev/fb#, but you get my point
<wnd>
Also might be that this isn't actually related to framebuffer at all but other other features that DO depends in stdin/out/err. Too many unknowns.
<Na_Klar>
you can easliy reproduce the issue: test.rb -> a = `fbi somepicture.png`. call "ruby test.rb" and you can "q" to quit fbi, run "ruby -- < test.rb" and fbi crashes immediately after displaying the image.
kerunaru has quit [Ping timeout: 260 seconds]
kerunaru has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
Nowaker has quit [Ping timeout: 260 seconds]
Nowaker has joined #ruby
cartdrige has joined #ruby
<adam12>
morning
kerunaru has quit [Ping timeout: 260 seconds]
grokify_ has joined #ruby
grokify has quit [Ping timeout: 248 seconds]
<wnd>
Crashing at the stage when input would be read sounds like a problem with the input fd, like stdin, perhaps. Maybe stdin is eof by the time Ruby finished reading the code from it, and fbi doesn't have a readable fd for input.
<Na_Klar>
that sounds like a possible explanation .. but not solveable, I guess.
crax23 has joined #ruby
Linux_Kerio has joined #ruby
cartdrige has quit [Read error: Connection reset by peer]
jpn has joined #ruby
Y05hito__ has joined #ruby
<wnd>
what if you open /dev/tty in Ruby for fbi?
crax23 has quit [Ping timeout: 252 seconds]
<wnd>
something like pid = Process.spawn('fbi', 'somepicture.png', in: '/dev/tty'); Process.wait(pid)
swaggboi has joined #ruby
<Na_Klar>
wow
<Na_Klar>
that seems to work ..
<Na_Klar>
I also tried `fbi somepicture.png &` with no success. how did you even come up with Process.spawn in dev/tty?
kerunaru has joined #ruby
<wnd>
When you do "ruby <foo", you use stdin for code input (and have it eof by the time Ruby starts executing code), making it unsuitable for interactive use. The same fd is used for child processes, unless explicitly stated otherwise. You also wrote that executaion fails at stage when input would be expected. So, if default input is closed, lets try opening another.
<Na_Klar>
ah I see .. that was good thinking. And it saved me a lot of trouble. So thank you very much. Much appreciated.
<wnd>
you're welcome
<Na_Klar>
Btw. can I catch stdout stderr from Process somehow?
<weaksauce>
but you can test drive a few chapters of it
grokify has joined #ruby
Y05hito__ has quit [Ping timeout: 252 seconds]
<leah2>
it's a good book for learning ruby, i learned ruby from it ;)
grokify has quit [Ping timeout: 260 seconds]
supay has quit [Quit: Connection closed for inactivity]
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
grokify has joined #ruby
<adam12>
It will be nice when the new Pickaxe is out.
<adam12>
Other than Jeremy's book, which is intermediate/advanced, I'm not sure of any newbie Ruby books out as of late. Hopefully pickaxe fills that. It's the one I learned Ruby from.
grokify has quit [Ping timeout: 248 seconds]
<weaksauce>
it's not too hard of a language to pick up really
<weaksauce>
at least the basics
<weaksauce>
eloquent ruby is my favorite but it's a bit too terse for completely new programmers
<adam12>
Eloquent Ruby is good. I think it's out of print?
<adam12>
(which means nothing but some people prefer dead-tree)
walez has quit [Ping timeout: 260 seconds]
idkwtf has quit [Quit: leaving]
grokify has joined #ruby
grokify has quit [Ping timeout: 246 seconds]
<weaksauce>
yeah it's probably still available used though