<FromGitter>
<drosehn> in my case I was reading from the process, not writing to it. So when the process dies, the `read_line` raises an exception. I also tried to use `p.terminated?`, only to see it didn't exist (or maybe it did exist at the time, but didn't do what I wanted it to do).
<FromGitter>
<drosehn> Also, while you have `while true`, I had `while ! hproc.output.closed?`. I'm not saying that's the right thing to do, but maybe it'll give you some more ideas of things to try for your case.
<FromGitter>
<drosehn> I used the variable `hproc` for what you have as `p`.
<FromGitter>
<talbergs> Yes, this time `begin ... rescue ... end` didn't change this for me. But I am reading from process here too. ⏎ ⏎ I undestood why the process is not exited when shell script is exited. (that while loop), because the docs states so: "Executes a process, yields the block, and then waits for it to finish." when &block is given. ⏎ ⏎ By the time I will get this process reading to finish as expected, I
<FromGitter>
<talbergs> The purpose of this is to pipe shell script output into some function (puts in this case). I see there a ton of lines and deeply nested stuff. ⏎ In my mind this could rather look like this ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5b3c13a09b82c6701ba03bea]
<FromGitter>
<drosehn> I don't know enough to help you there, and I'm tied up with other projects right now. I'd think we'd have to really understand how Process.run works (by looking at the source-code for it), and I don't have the time to do that right now.
<FromGitter>
<talbergs> Much appreciated, If I may be in any help to you, give it a shot, Ill be online some time.
<FromGitter>
<bew> @jwoertink you can do `enum Foo : UInt8; Bar = 2; Bar = 4_u8; end`
wontruefree has quit [Quit: bye]
zachk has quit [Quit: Leaving]
<crystal-gh>
[crystal] maxfierke opened pull request #6324: Fix: Disallow setters with multiple arguments (master...mf-disallow_mutli_arg_setters) https://git.io/fbl4P
wontruefree has joined #crystal-lang
<FromGitter>
<drosehn> I played with my little test program a little more, and it seems like Process.run() always returns NIL. But that may be because I keep reading the output and error IO streams until the IO::EOFError is raised.
<FromGitter>
<talbergs> Do you use the latest crystal version?
<FromGitter>
<drosehn> compiled by crystal 0.25.1 [5.0.2]
<FromGitter>
<talbergs> same here. What IDE do you use?
<FromGitter>
<drosehn> "IDE"? 😊 I'm on a Mac, and all I'm using is Xcode to edit the program, and then I compile-and-run the program in a unix Terminal window.
<FromGitter>
<drosehn> MacOS El Capitan, so I'm a little behind the curve on MacOS versions (which also means I'm a little behind on Xcode releases, since the latest Xcode won't run on El Capitan)
<FromGitter>
<talbergs> I'm on mac too, maybe xcode has intelligent completion for crystal. I have almost never used xcode (cos it's heavy on resources - cpu and memory).
<FromGitter>
<drosehn> Do you get a non-NIL status? If so, then the NIL I'm seeing is probably just to how I'm abusing the interface.
<FromGitter>
<talbergs> tried to make vim completion to work - no decent luck =/
<FromGitter>
<drosehn> Well, I just tell Xcode to syntax-color for Ruby, and that's good enough. Other times I use Sublime Text. I'm just used to Xcode, and I'm running on a Mac Pro with 48-gig of RAM, so resources aren't a problem. Not sure what that has to do with `Process.run()` returning NIL though.
<FromGitter>
<drosehn> Well, if you're not interested in Xcode (and many people are not), Sublime Text or maybe Atom might be of interest to you.
<FromGitter>
<drosehn> Atom might even be better than Sublime Text, for all I know. It's just that for a long time Atom had a few bugs in it which really irritated me. Those have been fixed now (after a few years...), but I haven't used it enough to compare it to Sublime Text.
<FromGitter>
<talbergs> If they provide intelligent code completion, inspection, static analysis, popup documentation, then yes im interested in Atom and ST
<FromGitter>
<drosehn> Well, they're free to download and test. But it's about 40 minutes past the time where I had intended to leave, so I have to head out now. Bye!
<FromGitter>
<talbergs> C ya!
<FromGitter>
<drosehn> To be clear: I use Xcode because I've been using it for 20 years, so I'm pretty used to it. I'm not saying it's a better choice than some of the newer editors!
wontruefree has quit [Quit: bye]
wontruefree has joined #crystal-lang
wontruefree has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
akaiiro[m] has joined #crystal-lang
<FromGitter>
<Blacksmoke16> any ideas what would cause Postman to return `Could not get any response` for a request that returns fine on chrome?
<FromGitter>
<talbergs> no, but I suggest swithing to Insomnia (tool)
<FromGitter>
<talbergs> Might be the case when server just gave plain empty resp
<FromGitter>
<Blacksmoke16> ` halt env, 404, response: %({"code": 404, "message": "An item with the provided ID could not be foudsfnd."})`
<FromGitter>
<talbergs> 404 - valid not found response
<FromGitter>
<Blacksmoke16> am getting a db record by id, if a valid id is used it works fine
<FromGitter>
<Blacksmoke16> but when doing a non existent id, postman does `could not get any response` while chrome produced the correct json
<FromGitter>
<Blacksmoke16> huh, seems to work occasionally
<FromGitter>
<talbergs> raw response please? Maybe something with headers and chrome is being user firendly.
<FromGitter>
<talbergs> oh no
<FromGitter>
<talbergs> that's bad :D
<FromGitter>
<talbergs> Maybe it is client - then try Insomnia
<FromGitter>
<Blacksmoke16> worth a shot
<FromGitter>
<talbergs> hmm, maybe response takes a long time
<FromGitter>
<Blacksmoke16> yea must be a bug with postman :shrug:
<FromGitter>
<Blacksmoke16> thats dumb, oh well
<FromGitter>
<Blacksmoke16> insomnia it is :p
fbu has quit [Quit: WeeChat 2.1]
akaiiro has quit [Remote host closed the connection]
marius has quit [Quit: baj]
marius has joined #crystal-lang
<FromGitter>
<bendietze_twitter> @Blacksmoke16 @talbergs for much testing purposes its very cheap to run https://github.com/icyleaf/halite spawned in your code - you can send the request and #to_raw the output to console - so first no need for a browser - saves much time - but lastly testing in browser / postman / imsomnia must be done too :) But, for most testing it is very nice to spawn it side by side to server code and let it
<FromGitter>
... run/output the needed requests just by starting your server :)
beizhia has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
<crystal-gh>
[crystal] icyleaf opened pull request #6328: Fix File.join with separator path component (master...fix-file-join-with-separator) https://git.io/fbxru
lvmbdv has joined #crystal-lang
alex`` has joined #crystal-lang
<FromGitter>
<bendietze_twitter> Has someone experiences with spawning multiple postgres on a single db server vs standard? I think it could help due splitting jobs/DBs in maintaining and security and at least (depending on machine/s) in performance against parallel options of pg? Or would someone never do this again, because it didn't help or became more complex overall/Recovery? I think, multiple could be a nice try? The other
<FromGitter>
... option would be multiple but running on several more job-calculated cloudservers? Today it's very cheap to run separate cloud-instances and increase their level as needed :)
<FromGitter>
<spTorin> In the future it is planned to add support for the interpretation mode and REPL? Or is it technically very difficult and have to wait for version 1.x and higher?
<FromGitter>
<bcardiff> @spTorin there is no current goal to have a repl before 1.0.
<FromGitter>
<bcardiff> It's challening due to the nature of crystal to allow a full featured repl. Partial support is possible though. The more similar thing right now that is built in is `$ crystal play`
<FromGitter>
<bcardiff> :-) it came a long way. helped discover lots of bugs in ToSVisitor, and is not perfect. If you want to see the very first screen of it http://g.recordit.co/5W2eDtlkwj.gif
<FromGitter>
<bararchy> I use it all the time, that's how I find those wierd bugs with it hahaha
<FromGitter>
<bcardiff> 👍 keep them coming, sometimes they are not about playground itself. But they helped.
<FromGitter>
<bcardiff> Did you use the workbook feature @bararchy or build presentations with it?
<FromGitter>
<bararchy> I did not, but I saw Lucky and Kemal using it, maybe we will do one for SHAInet :)
<FromGitter>
<bendietze_twitter> Hehe, when started with Crystal playground i found a possible bug, but i forgot it... Would you like to test? It freezes every browser and system i tried with... Please edit https://play.crystal-lang.org/#/r/4g7v/edit the following: first denote 'HERE and then 'HERE' the second one or first the right ' and then the left ' :) I tried on my phone, at work and at home, mostly with chrome
<FromGitter>
<bendietze_twitter> I meant it freezes the browser tab, not the systems at all
<FromGitter>
<bararchy> if were talking about phone, the play.crystal-lang.org is so bad on mobile, I can't even type most of the times, it will just overwrite charcters at random and then delete random stuff
<FromGitter>
<bendietze_twitter> @bararchy you must type more slowly 😆 i have had this to :)
<FromGitter>
<bararchy> lol hahaha
<FromGitter>
<bendietze_twitter> Sometimes i thought i will hammer my phone, but it's like the monitors or the keyboards they will be destroyed for the errors of the PC 😆
<FromGitter>
<bendietze_twitter> Oh, and if you worry about playground on mobile - please, first try gitter 😆
<RX14>
@straight-shoota I think that your path_spec is probably not going to be well portable
<RX14>
you should spec everyting *explicitly* as both windows and unix paths
<RX14>
and then have a small section at the bottom that deals with anything to do with native paths
<RX14>
and the few small bits of "unpurity"
<RX14>
like stuff that uses the dirrect directory
<RX14>
current*
<FromGitter>
<bendietze_twitter> @straight-shoota the Go tour discussion - very good idea 👍 but for me i haven't used it - i am more for reading @sdogruyol ;)
<RX14>
to me it rings huge alarm bells that you would need a "win_base" helper
<FromGitter>
<jspillers> I know I am probably overlooking something really simple, but is there a better way to guard against nilable properties (really just macro'd instance var with accessor) than to assign an intermediate local var? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5b3cd7db70efc60660acb073]
<FromGitter>
<bendietze_twitter> @bararchy i don't know ... Can't figure it out after reading 5.times on my mobile 😄 could be is just syntactic sugar - or nice game :) i will check this out for me 👍
<FromGitter>
<bararchy> I saw this guy is making other logos for other projects, hahah Crystal project :)
cyberarm has quit [Ping timeout: 260 seconds]
<FromGitter>
<bendietze_twitter> One cool thing on C# is their delegates. I like their 'delegate += whatever' or '-=' and just call 'delegate'... Is there something similar or near in Crystal? :)
<FromGitter>
<talbergs> Reason is - web ui has button to stop process (wsocket.on_message), so I could call `proc.kill` there
<FromGitter>
<talbergs> 2nd question is, why the `while` loop above, never stops? Should'n `rec.gets` return nil at some point? And if within `while` I check for `process.terminated?` < thats always false, how so?
<FromGitter>
<bew> For an interactive tty program you can have 2 stdin (kindof), the basic STDIN you know to get the file from a pipe, and you can open `/dev/tty` and do read/write operations on it to directly read/writd from/to the tty
<FromGitter>
<bew> RX14 ^ here is the "black magic" :P
<FromGitter>
<bew> @talbergs you could save the proc variable somewhere where it can be called from another handler (and killed from there)
<FromGitter>
<bew> `rec.gets` will return `nil` only if the other end of the pipe is closed, which will happen only if the child process ends iirc
<FromGitter>
<bew> Also you can avoid building the pipe yourself, you can call Process.run with `output: :pipe`, and for the while, do `while o = proc.output.gets`
<FromGitter>
<bew> Finally, why do you think the process should be terminated? You are reading its output while it is running, so it's not terminated..
<FromGitter>
<asterite> @valamorgon you have to assign it to a local variable first
<FromGitter>
<valamorgon> @asterite but the problem is, my function is calling itself rescursively, I need to keep adding information to my variable. Since global variables not supported anymore, how can you save your info to a variable rescursively?
<FromGitter>
<valamorgon> local variable would mean overriding in each call for recursive function calls
<FromGitter>
<bcardiff> Either the `@@var` needs to be not nillable. or before recurring you will need to update it's value.
return0e has quit [Remote host closed the connection]
wontruefree has joined #crystal-lang
<FromGitter>
<bcardiff> no, like, you should avoid it :-). I'm not sure what you want to do since the code will hang since there is no base case for the recursion. Without that is harder to suggest a way to go. A general tip is that if you need state to be carried, make it a parameter.
<FromGitter>
<valamorgon> I see, I will consider it, thanks
<FromGitter>
<bew> Also @valamorgon if you plan to use a recursive that appends stuff to a string, this is quite slow and you might want to use a `IO::Memory` that you populate in the recursive, and finish by doing `to_s` on it to get a string back
<FromGitter>
<valamorgon> @bew you mean @@myvar should be equal to IO::Memory?
<FromGitter>
<valamorgon> and one more question, XML::Node children method returns also text between two tags? is this expected behavior? shouldn't it return just element children?
<FromGitter>
<bararchy> I wish someone would teansalte the timeline and talks (as in what talks are going to be there)
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
daemonwrangler has joined #crystal-lang
daemonwrangler has quit [Remote host closed the connection]
daemonwrangler has joined #crystal-lang
<oprypin>
gee anything in europe?
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
daemonwrangler has joined #crystal-lang
<Yxhuvud>
oprypin: we should do a meetup in stockholm
return0e has joined #crystal-lang
<oprypin>
Yxhuvud, i was just thinking that the other day
<oprypin>
when you wrote "uri:s" :D
<Yxhuvud>
so basically about 24 hours ago :P
<crystal-gh>
[crystal] felixbuenemann opened pull request #6332: Add XML::Reader ParserOptions Support (master...xml-reader-parser-options) https://git.io/fbpBm
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
daemonwrangler has joined #crystal-lang
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #crystal-lang
<FromGitter>
<j8r> @bew The solution with `TTY_STDIN = File.open "/dev/tty"` instead of `STDIN` works perfectly, I ve set a buffer of 4096, all works perfectly. I don't miss to `TTY_STDIN.close`at the end. However, when I resize the terminal, an exception is raised:`Error reading file: Interrupted system call`. Have you an idea about?
<FromGitter>
<Val> Is it a way to know current process `euid` in Crystal ?
<FromGitter>
<Val> Like in Ruby `Process.euid`
<FromGitter>
<j8r> More I advance, more I'm replacing Termbox with native Crystal 😄
<FromGitter>
<bew> @j8r nice! I'm working on doing that too :P I'm working on a terminfo parser (already done actually I just need a better API to use it)
<FromGitter>
<j8r> @bew have you a link on this project? I could use it, and merge some of my work on it maybe
<FromGitter>
<bew> @j8r for the interrupted system call maybe try to catch the error, and re-try the read
<FromGitter>
<bew> @j8r it's currently a private repo, I don't have time now to polish, but yeah it might be a good idea for you to use it and give me feedback ;)
<FromGitter>
<bew> also it's currently not fully usable, for example you can't use parameterized string capabilities yet
<FromGitter>
<j8r> This is a library about parsing the terminal input right?
<FromGitter>
<bew> no, this will be another one
<FromGitter>
<j8r> this is for display so?
<FromGitter>
<j8r> Nice because this is the only part of Termbox i still rely for
<FromGitter>
<bew> no, this is to read the terminfo database that should be used by programs to know how to talk to the terminal, see https://linux.die.net/man/5/terminfo
<FromGitter>
<j8r> in can build "CLI vues" with this?
<FromGitter>
<bew> no idea what you mean by "CLI vues"..
<FromGitter>
<j8r> describe margins, colors etc?
<FromGitter>
<j8r> Ok I better what it does
<FromGitter>
<j8r> | it tells application programs what the terminal is capable of doing ⏎ We need terminfo to interact with a terminal, ok go it
return0e has quit [Remote host closed the connection]
beizhia has quit [Quit: ERC (IRC client for Emacs 26.1)]
duane has quit [Ping timeout: 240 seconds]
greengriminal has joined #crystal-lang
akaiiro has joined #crystal-lang
alex`` has quit [Ping timeout: 260 seconds]
<crystal-gh>
[crystal] straight-shoota opened pull request #6333: Extract platform-specifics from ENV to Crystal::System::Env and implement for win32 (master...jm/feature/windows-env) https://git.io/fbpup
lvmbdv has quit [Ping timeout: 240 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
return0e has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]