#ruby - 31 July 2017
« Back 1 day Forward 1 day »
[07:31:15] Genya: I'm experienced full stack developer and wanted to try out Ruby (not Ruby on rails)
[07:32:12] Genya: Well I just wanted your thoughts on what good and bad about the framework you see.
[07:39:56] Genya: I am looking for one that more towards front-end and not so much backend. I'm abstracting much of the backend work to mircroservices
[08:14:10] ineb1: altough i havent done a large project with it yet. but with sequel (an orm mapper from the same author) which is very good
[15:18:32] merimel: I've got a problem too; with psych serialization — for some reazon some of array items in my array won't get in resulting file, only  gets in, instead of actual data
[15:20:07] havenwood: merimel: Odd. Have a smallish test-case or only reproduced with full code so far?
[15:21:29] merimel: well it's rough code, and you also need to have some fonts, I can package .tar.gz ro mega.nz
[16:04:53] catphish: i'm looking at open3, and it appears that when it executes anything it creates a thread, is there a simple equivalent that doesn't do this (but still sets up pipes for stdin and stdout)?
[16:08:27] apeiros: yeah, spawn is the newer tool in the box and the swiss army knife for all things subprocesses.
[16:09:07] apeiros: hm, I'm not sure anymore why open3 created a thread. might have to do with $? being thread-local?
[16:10:49] catphish: maybe there's no non-blocking way to collect the exit code otherwise, i'm not sure yet
[16:11:59] apeiros: i.e. open 2 processes and you can't tell which process' exit status you have in $?. but I don't really remember.
[16:18:30] apeiros: ok, well, nonblocking waitpid exists for at least 4y, probably more like 6 because I didn't put it on github for ages…
[16:19:27] apeiros: me, copy pasta mistake. https://github.com/apeiros/fork/blob/master/lib/fork.rb#L600
[16:20:31] catphish: although, actually it's more complicated than that because i want it to work in an event driven app
[16:23:23] apeiros: oh, you talked about pipes above, so I assumed you were communicating with the child
[16:24:09] catphish: i am planning to communicate with it, but there's no guarantee that it doesn't close its STDOUT, but then stay running a while, right?
[16:25:37] apeiros: so yes, you'd need provisions against that and keep reading the exit status on such cases until it terminates
[16:26:00] catphish: sadly i don't know of any way to do this in an event driven manner, but i'll check
[16:27:49] apeiros: if you have something reactory where you have a loop waiting for events you add a timeout to the waiting part (with IO.select trivial, as it's part of the API) and retry collecting exit states there
[16:28:21] catphish: tbh i was on the fence about whether to just go with threads on this app anyway, so might do that, then i can just block waiting for the exit code after stdout goes away
[16:30:35] catphish: it's a pretty simple server that receives some data from a socket, sends it to a spawned docker, reads back the results and sends them back to the client, there will only be a handful of clients at a time, so threads arent the end of the world
[18:19:07] merimel: figured out my problem with Psych — it was not Psych, but my use of Array.shift (which acts like ! <bang>)
[18:29:46] adam12: merimel: Pretty sure you use dup unless you find it doesn't work for you, which in case you switch to clone