ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.34.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> We become the internet
<FromGitter> <Blacksmoke16> Like the Matrix
<FromGitter> <snadon> I'm getting this error from time to time when deploying on Heroku: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5eb4a6533d58de7a38fff7ac]
<FromGitter> <Blacksmoke16> wouldnt it be easier to build a static binary on alpine, then just upload that binary?
<FromGitter> <Blacksmoke16> versus trying to install/build on heroku
<straight-shoota> both approaches should work
<straight-shoota> suggesting something entirely different doesn't help to solve the problem at hand ;)
<FromGitter> <Blacksmoke16> dont need to solve the problem if there is no problem in the first place :p
<FromGitter> <snadon> It is an automatic deployment when merging a PR. Also, the Github Action builds and runs the spec just fine.
<FromGitter> <Blacksmoke16> same OS on the action/heroku?
renich has quit [Quit: renich]
<FromGitter> <Blacksmoke16> possible lucky scripts dont support x architecture?
<FromGitter> <Blacksmoke16> :shrug:
<straight-shoota> Unlikely
<FromGitter> <snadon> It is intermittent
<FromGitter> <snadon> Usually it builds just fine but today I got the error twice
<FromGitter> <paulcsmith> This is an issue that has happened with numerous people in Docker containers as well. Some even ran into it when building locally
<FromGitter> <paulcsmith> So not just Heroku and pre compiling a binary is not what everyone can or will do. Plus it may still have issues since there are intermittent issues with Docker compiles as well
<straight-shoota> @paulcsmith is there an issue for that?
<straight-shoota> #9148?
<DeBot> https://github.com/crystal-lang/crystal/issues/9148 (Can't build/run with Homebrew on Linux)
<FromGitter> <paulcsmith> Yes I believe both of those are what people are seeing
<FromGitter> <paulcsmith> Since it is intermittent I have no idea what is causing it and it is just about impossible to reproduce. I do know that @jwoertink said that this issue appeared (I think) on v0.34 and was fine on 0.33
<FromGitter> <snadon> I know I got it in the past but a while ago so I think 0.33 was fine
<straight-shoota> Why are you aware of these issues with multiple users but there are only two reports on the issue tracker? :D
<straight-shoota> Seems like a nasty debugging task unfortunately :(((
<straight-shoota> @snadon please add your details to the issue I mentioned
<FromGitter> <paulcsmith> Yeah definitely. I've not had any time to dig into it. It has actually only happened to me once so hasn't caused me too much pain, but I know others see it a lot more often for some reason
<FromGitter> <paulcsmith> Even though that is about homebrew, I'm guessing there is a similar route issue. It looks pretty similar on the surface at least
<straight-shoota> The issue states it's running on docker
<straight-shoota> that seems the unifying ground
<straight-shoota> Let everyone add to the issue. Even if the error is not easy to grasp. That makes it even more important to have more reports.
<FromGitter> <paulcsmith> I've had it locally on macOS. I will add that to the issue
<FromGitter> <paulcsmith> And Heroku does not use Docker by default. The buildpack being used uses some Heroku specific container magic
<FromGitter> <paulcsmith> But I dunno, maybe it is especially prevalent with containers of any kind 🤷‍♂️
<straight-shoota> could be
<straight-shoota> obvious similarity is that it starts showing up with 0.34.0
straight-shoota has quit [Ping timeout: 260 seconds]
<FromGitter> <watzon> One more thing to add to my `crystal-term` org
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
hightower2 has quit [Ping timeout: 272 seconds]
rocx has quit [Ping timeout: 260 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 260 seconds]
<FromGitter> <didactic-drunk> Is there any way to debug the require path? By showing every attempted require?
<FromGitter> <watzon> Not that I know of
<FromGitter> <watzon> What's going on?
<FromGitter> <didactic-drunk> `require "compress/zstd"` doesn't work. My changes aren't published yet.
<FromGitter> <damianham> @all Guys - if you are following the news I am sure you may now be aware of the controversy surrounding the simulation software used by Professor Neil Ferguson to model the spread and fatality rates of Covid-19. Basically they have been using some software (that may have been transpiled from Fortran) that has just 1 test, is non deterministic (although the game theory guys say that is OK), is written in C++
<FromGitter> ... with the no classes, has many files with thousands of lines (one 5404 lines), functions of >400 lines and produces random results on each run so the model needs to be run multiple times and take the average. It has been severely criticized as amateur hobbyist code by a seasoned ex Google developer. Professor Ferguson has ... [https://gitter.im/crystal-lang/crystal?at=5eb4eb4a97338850a2f4bae3]
return0e has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
hightower2 has joined #crystal-lang
_ht has joined #crystal-lang
<raz> john carmack says it's ok, so it's ok
<raz> i'll take his word over any "ex-googler" any day of the week
zorp has joined #crystal-lang
wakatara has joined #crystal-lang
alexherbo2 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
<FromGitter> <RomainFranceschini> While it certainly could have been written in a better way, its unfortunately pretty common that models are released in a similar state, written in an ad-hoc way, with few tests (if any), sometimes re-used for different purposes. The main issue is that such models are usually not written by computer scientists, they are written by domain experts (epidemiologists in this case). As such they are just
<FromGitter> ... interested in validation (i.e. whether their assumptions fits reality), not verification (i.e. does the model implements those assumptions correctly).
<FromGitter> <RomainFranceschini> There's nothing wrong if the model is non-deterministic. Stochastic models are really common to model uncertainty. It's fine to take the average behaviour as long you have means to make a run deterministic (e.g. by setting the random seed)
<FromGitter> <RomainFranceschini> The question is whether the assumptions that are used for this model fits the reality. I'm not an epidemiologist so I won't do that as a computer scientist. So I don't think there's a point in reproducing this model in another language.
<FromGitter> <RomainFranceschini> But it's interesting to question the meaningfulness of this model, there's plenty of others models from other labs to compare with, both in terms of assumptions and results.
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
<FromGitter> <RomainFranceschini> BTW I'm a postdoc in a modeling and simulation lab so I really like those questions. Our role is to offer formalisms and tools to domain experts so they can choose the most appropriate one to develop a model given a set of properties of interest
<raz> wise words romain. yes, totally agree with questioning the models and helping with the code. unfortunately in this particular case there has been a flood of politically motivated spam from people who don't know zilch about code or the underlying models.
<raz> that's harmful not only because it distracts from proper reviews of this particular simulator, but also discourages scientists from publishing their code in general
<raz> suggesting some rando could just rewrite 5k lines of a complicated simulator on a weekend, without the scientific background that went into it, is just silly.
<FromGitter> <Uzay-G> How can I tell the compiler that I know a certain variable is not nil?
<FromGitter> <Uzay-G> For example:
<FromGitter> <Uzay-G> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5eb52a225cd4fe50a3f91f31]
<FromGitter> <Uzay-G> This only gets called if `current_user` is not nil. How can I ignore this error then?
<FromGitter> <Uzay-G> ok thanks
<FromGitter> <Uzay-G> In ruby you can also do for example `current_user&.value` which returns nil if `value` is not defined
<FromGitter> <Uzay-G> that could be interesting
<sorcus> https://www.facebook.com/180115459433/videos/551532062445808/ - Andy Serkis reading `The Hobbit` online, if someone interesting.
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
<raz> a little thing i've been wondering about for a while. is the second construct slower here?: `"foo #{some_computation()}"` vs `bar = some_computation(); "foo #{bar}"
<raz> `
<raz> i imagine the compiler must be smart enough to inline that, so they should be the same. but is that really true?
<raz> (premise being that it really looks exactly like that. i.e. "bar" is not used again later or such)
<jhass> raz: "foo #{bar} baz" is rewritten to String.interpolation("foo ", bar, " baz"), so the question is, is a = 1; foo(a) slower than foo(1)? Well, how do we pass an argument to a function? We push it onto the stack. Whether we push that value from an intermediate (some memory location), another place in the stack (some memory location) or the heap (some memory location) shouldn't make a
<jhass> difference. So in this simple example they are the same. Now if the source of that local variable is a bit more complex and becoems opaque to LLVMs optimizer, that might influence certain optimizations like inlining the call or precomputing operations on constant values.
<raz> gotcha. as usual it's a bit more complicated than my little brain imagined.
<jhass> But all of this is minor and low level enough that you shouldn't spend ANY headspace on this unless in optimization mode for a performance criticial bottleneck of you application that you previously identified. And even then only after you're done with any algorithmic or structural optimizations you could make to that.
<jhass> so to summarize: you don't need to care about this.
<raz> yup, the extra variable allocation likely doesn't make a difference in any but the tightest looped real world scenarios
<jhass> and there only if it actually survives the optimizer
<jhass> so it's somemthing where you'd look at the optimized LLVM IR, imagine which operations you could save and trace that back to your code
<raz> yep got it. was more of a curiosity. thx!
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
straight-shoota has joined #crystal-lang
<jhass> is there any way to fake global variables? I cannot allocate memory yet
<jhass> and __crystal_once does, so no constants or class vars :/
<FromGitter> <lodenos> I have a problem with HTTP::Client inside it test ⏎ Since yesterday I tourn around my computer, ⏎ How it's possible an HTTP::Client.get can't work inside a it test. ⏎ Example: ⏎ First case I can call my API Route ... [https://gitter.im/crystal-lang/crystal?at=5eb5454f7a24ff01b00cd0bf]
<FromGitter> <lodenos> I have look the code of 'it' and Example.cr and everything look normal
<oprypin> jhass: yes just @@var
rocx has joined #crystal-lang
<jhass> no, that goes through __crystal_once
<oprypin> huh
<oprypin> `lib` supports global vars
<jhass> yes, referencing them, not declaring them
<oprypin> or call a c function that sets its own global and exposes it as a return value
<jhass> lib + a c files that just declares one works, but I mean ...
<oprypin> and aren't constants global variables
<jhass> yes, they also go through __crystal_once, see link above
<straight-shoota> @lodenos how are you running the HTTP endpoint?
wakatara has quit [Ping timeout: 260 seconds]
<FromGitter> <lodenos> @straight-shoota I have create another prog in crystal
<FromGitter> <petyan> hey! does any one know how I can list all object's methods? something like python's dir()
<FromGitter> <petyan> for example in docs for http client I see that `response.body` has `lines` but can I get others from code? ⏎ https://crystal-lang.org/api/0.24.1/HTTP/Client.html
Vexatoast has joined #crystal-lang
Stephie has quit [Read error: Connection reset by peer]
Vexatos has quit [Read error: Connection reset by peer]
<FromGitter> <lodenos> @petyan Great Question but the documentation is really explicit
Stephanie has joined #crystal-lang
jhass has quit [Ping timeout: 256 seconds]
jhass has joined #crystal-lang
<FromGitter> <lodenos> @petyan Look this topic https://github.com/crystal-lang/crystal/issues/403
<FromGitter> <petyan> thanks! just thought mb things changed since 2017
<FromGitter> <lodenos> @petyan I think actually it's another priority, to be honest I go more fast to looking the online
<FromGitter> <lodenos> Because with the macro it's sometime it's being defilcult because u need compiling each time
<FromGitter> <petyan> yup I guess it's not useful for compiled langs, was just testing it in playground and expected smth of sorts here
alexherbo2 has joined #crystal-lang
daemonwrangler has quit [Ping timeout: 256 seconds]
daemonwrangler has joined #crystal-lang
lanodan has quit [Ping timeout: 252 seconds]
<FromGitter> <codenoid> stay safe crystal folks <3
<FromGitter> <Blacksmoke16> @petyan `{{MyType.methods}}`, also you're browsing old docs as a heads up
<FromGitter> <Uzay-G> do you guys know any crystal shards i could use to escape js and prevent xss?
<FromGitter> <Blacksmoke16> like `&` => `&amp;`
<FromGitter> <Uzay-G> no more like "><script>console.log("ddsdsfsf") = > ""
<FromGitter> <Uzay-G> because i am using amber and I think it only escapes html, so if i render something in js it might be unsafe
<straight-shoota> so you want to scrape tags, not escape them?
<FromGitter> <Blacksmoke16> sanitize prob is the better word
<FromGitter> <Uzay-G> yeah that's what i meant
<FromGitter> <Uzay-G> sorry
<FromGitter> <Blacksmoke16> nothing built in that i know of
<FromGitter> <Blacksmoke16> possibly could be something to go in the `HTML` module, like php's `strip_tags`?
straight-shoota has quit [Quit: Leaving]
straight-shoota has joined #crystal-lang
<straight-shoota> jhass, that's for escaping javascript inside <script> tags
<jhass> mh, maybe I understood the requirement wrong then :D
<jhass> for general HTML injection, HTML.escape should be fine, no?
<straight-shoota> it avoids injection, but IIUC the goal is to completely remove <script> tags
<straight-shoota> in a very simplified form s/<script.+<\/script>// would to that
sagax has joined #crystal-lang
<jhass> and then I'll come along and do <img src="javascript:alert(0);" /> :P
<straight-shoota> yeah, there are lot more edges to cover
<jhass> short of fully parsing the HTML and extracting just the text nodes, I think there's no sane way to "scrub" HTML out
<FromGitter> <Uzay-G> it's more scrubbing for js
<FromGitter> <Uzay-G> so like I wouldn't have a problem having the `string` in question inside a js file
<jhass> so an escape_javascript kind of thing after all :)
<FromGitter> <Uzay-G> yeah :)
<jhass> Rails implementation should be fairly simple to port
<straight-shoota> are you sure you only need to disable javascript?
<straight-shoota> what about other HTML features like iframe, object, embed, link?
<straight-shoota> there is unfortunately no proper HTML sanitizer implementation for Crystal
gangstacat has quit [Ping timeout: 272 seconds]
<straight-shoota> IMO that would be quite an important security feature to protect data that comes from user input and allows arbitrary HTML.
<straight-shoota> Like every Markdown text field
<jhass> Rails' escape_javascript is intended for interpolation into <script> tags, that's why it escapes </
<jhass> that makes it so you cannot escape the script tag. HTML within a script tag is interpreted as javascript and just screws up running that
<FromGitter> <Uzay-G> doesn't this sanitize: https://crystal-lang.org/api/0.34.0/ECR.html
<FromGitter> <Uzay-G> i thought it automatically sanitized things
<FromGitter> <sagotsky> Hi there. I've been watching crystal for a while but only recently tried tinkering with it. I had a ruby script that just wasn't snappy enough and I thought this seemed like a good chance to play with crystal. Where I'm stuck and google is failing me, is reading from a long running process. I got `Process.run` to run something. I gave it an `IO::Memory` to capture stdout. But to waits for the process to
<FromGitter> ... finish. I'd like it read from the process, let me react to that new data, then block until there's more to read. In ruby, I think I used popen3 for that, but I'm having trouble finding something equivalent here. Anyone have any hints for me?
<straight-shoota> @Usay-G ECR is just string expansion. It doesn't have any context awareness. It doesn't even care whether it expands to HTML or any other format
<jhass> sagax: essentially you want to change .run for .new
<jhass> ah sorry, sagotsky ^
<jhass> either the block form or if not, make sure to call waitpid after you're done reading (or do the reading in another fiber and waitpid on the main fiber)
<FromGitter> <Uzay-G> oh no i thought it escaped like `ERB`
<jhass> ERB does not escape anything, it's the very same concept
<FromGitter> <Uzay-G> but then how do web frameworks like `Amber` or `Lucky` even work?
<jhass> Rails patches ERB to escape things
<FromGitter> <Uzay-G> oh ok
<straight-shoota> I'm not even sure lucky uses ECR
<straight-shoota> by default it uses a crystal-based DSL for generating HTML
<FromGitter> <Uzay-G> oh wow this is a problem... I need to find a way to escape all values
<FromGitter> <Uzay-G> yeah it uses luckyHTML
<FromGitter> <sagotsky> ty @jhass!
<jhass> sagotsky: oh I think it's just Process::Status#wait or so for waitpid these days
<jhass> but block form is probably fine for your needs
<jhass> and ups again, looks like the block form moved to run
<jhass> kinda makes sense
gangstacat has joined #crystal-lang
<FromGitter> <sagotsky> block form with wait/waitpid is the hint i needed :)
<jhass> either block form or #wait :D
_ht has quit [Remote host closed the connection]
<jhass> run is essentially new.wait, run(&) is essentially p = new; yield p; p.wait
_ht has joined #crystal-lang
_ht has quit [Client Quit]
_ht has joined #crystal-lang
HumanGeek has joined #crystal-lang
Human_G33k has quit [Ping timeout: 272 seconds]
<repo> if i were to use some code from shards, how would i require it in my script?
<repo> i tried just requiring "shards/versions" which is what i need to use, but crystal can't find it
<FromGitter> <Blacksmoke16> did you install it?
<repo> shards?
<repo> of course
<FromGitter> <Blacksmoke16> as a dependency i mean
<repo> or do you mean as a dep
<repo> hm
<repo> no
<FromGitter> <Blacksmoke16> that would do it
<repo> i c
<repo> ic
<repo> so no way to access the globally installed shards?
<repo> yeah ok it doesn't include source
<repo> s
<repo> makes sense
<repo> Missing "v0.1.0:shard.yml" for "shards"
<repo> hmm
<FromGitter> <Blacksmoke16> pin it to a version?
<repo> ah
<repo> yup that did the trick
<repo> thanks
renich has joined #crystal-lang
wakatara has joined #crystal-lang
wakatara has quit [Client Quit]
<straight-shoota> yeah that missing "v0.1.0:shard.yml" is a bug and already fixed
lanodan has joined #crystal-lang
<FromGitter> <matthewmcgarvey> I've been trying to use the `at_exit` hook to make sure a process is stopped when the code finishes but I can't figure out how to call a method in the current context from within the passed in block. The broken code looks like: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ It fails because `stop_process` is not a method inside the `at_exit` context [https://gitter
<FromGitter> ... .im/crystal-lang/crystal?at=5eb59317a9de3d01b1f83269]
<jhass> oprypin: ugh, one for the bot todo list ^
<jhass> matthewmcgarvey: matthewmcgarvey maybe you reduced it a bit too much?
<straight-shoota> `at_exit` is a global method, it doesn't inherit the lexical scope.
<jhass> ups, copy paste fail: https://carc.in/#/r/916h
<FromGitter> <straight-shoota> oh, nvm it does
<FromGitter> <straight-shoota> but that's probably not ideal solution
<FromGitter> <didactic-drunk> Is there an equivalent of ruby's module `prepend`?
<jhass> I don't think we have
<FromGitter> <didactic-drunk> A workaround?
<jhass> what do you need it for?
<jhass> (please don't just describe how prepend works :D)
<hightower2> :)
<FromGitter> <didactic-drunk> The module is an satisfies an interface. Also a few methods are hooks, meant to be overriden but still call super with the default implementation.
<jhass> and you can't use a base class?
<jhass> possibly abstract
<oprypin> sounds like module `extend` functionality is wanted
<FromGitter> <didactic-drunk> Nope. `prepend`.
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/916s ?
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
<FromGitter> <didactic-drunk> https://carc.in/#/r/916t
<oprypin> didactic-drunk, guess you'll have to use ruby then
<FromGitter> <didactic-drunk> `M` is missing inn the output. It works in ruby with `prepend`.
<raz> oprypin: hey, no reason to be cruel here! :,(
<FromGitter> <Blacksmoke16> https://carc.in/#/r/916y ?
<FromGitter> <kingsleyh> hi - what is the best way to generate 64 bytes random secure
<FromGitter> <Blacksmoke16> `Random::Secure.random_bytes 64 ⏎ `
<FromGitter> <kingsleyh> oooh thanks
<oprypin> raz, who's cruel
<raz> oprypin: friends don't tell friends to use a legacy language!
<oprypin> now thats cruel
<FromGitter> <didactic-drunk> @jhass I am using an `abstract Base` class. This is a simplified example. I'm using more than one module. Some provide an Interface, others provide implmentations, some do both. This `Base` class needs to include a module both providing an interface and hooking in to the exisiting methods in `Base`.
<jhass> is it important that M#foo is called first?
<FromGitter> <didactic-drunk> @Blacksmoke16 I didn't know it worked like that.
<jhass> ah yeah, looks like you can just include into the base in your case
<oprypin> B A M foo :>
<jhass> or potentialy into the child https://carc.in/#/r/9174
renich has quit [Quit: renich]
<jhass> but neither is exactly prepend's behaviour I guess
<raz> hmm, in other news, we really need a hero to parallelize shards (the git clones)
<FromGitter> <didactic-drunk> It's not going to work. My example is too simple. @oprypin's example is what I'm using to work around this bug, but every subclass needs to include the module which is less than ideal.
<FromGitter> <Blacksmoke16> ```macro inherited ⏎ include M ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5eb59fb797338850a2f706d2]
<FromGitter> <neutrinog> Here's the final solution to the reference pool I was trying to figure out yesterday. In case anyone cares. Thanks for the help! https://github.com/neutrinog/prism/blob/4d43475be0d44449e05bd1ee029424bc39fcac3b/src/prism/reference_pool/reference_pool.cr#L24
<FromGitter> <didactic-drunk> @Blacksmoke16 👍
<FromGitter> <didactic-drunk> Now if someone would accept a PR with `prepend` doing that...
<FromGitter> <didactic-drunk> I guess it's not the same.
<raz> neutrinog: wow that's a nice shard!
<raz> i smell another minecraft on the horizon
<FromGitter> <neutrinog> Thanks @raz.
<FromGitter> <neutrinog> I've never actually made a 3d game before. lol. but building an engine sounded fun.
<oprypin> neutrinog, yea thats a nice solution
alexherbo2 has joined #crystal-lang
<FromGitter> <kingsleyh> hello - what would be the best way to remove the first byte of a hex string? hex_string.to_slice(1,-1)
<FromGitter> <kingsleyh> actually I probably want hexbytes
<FromGitter> <kingsleyh> yes this works: hex_string.hexbytes[1..-1]
<jhass> I mean you kinda know a byte is two characters in that, so just hexstring[2..-1]?
<jhass> my C is weak, what's (void *)(word)i doing? (i is int)
renich has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<travis-ci> crystal-lang/crystal#807e219 (master - Fix version selector in API docs shows current version twice (#9250)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/684839160
travis-ci has joined #crystal-lang
<DeBot> https://github.com/crystal-lang/crystal/pull/9250 (Fix version selector in API docs shows current version twice)
_ht has quit [Remote host closed the connection]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#8705717 (master - Update distributions-script (#9242)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/684854891
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/9242 (Update distribution-scripts)
zorp has quit [Ping timeout: 264 seconds]
<FromGitter> <jwaldrip> Would it be helpful if crystalshards.org allowed for webhooks so that we could immediately index for changes upon a push of a new github tag?
<FromGitter> <matthewmcgarvey> That was helpful above about the `at_exit` but unfortunately there's still a problem. I have specs that depend on this process starting before the specs and closing it after and I'm adding the `at_exit` because the process could be left running if you do ctrl-c during a test or something like that. Just to verify my `at_exit` was working i added: ⏎ ⏎ ```at_exit { puts "FOOO" }``` ⏎ ⏎ and ran
<FromGitter> ... my specs. I see the string get printed with the first spec but doesn't get printed at the end of the specs running. ... [https://gitter.im/crystal-lang/crystal?at=5eb5dd38f0377f163177643d]
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Spec.html#before_suite(&block)-class-method ?
<FromGitter> <Blacksmoke16> pretty sure specs are ran using `at_exit`
<FromGitter> <Blacksmoke16> so you should use the spec hooks instead of another at_exit hook
<FromGitter> <matthewmcgarvey> I made a minimal example so that you wouldn't have to understand everything https://github.com/matthewmcgarvey/crystal-at-exit-example
<FromGitter> <matthewmcgarvey> seems like I didn't need to and that does not seem like a good idea
<FromGitter> <Blacksmoke16> prob related to Spec, using `at_exit` too, so it would run your at_exit before running the specs
<FromGitter> <Blacksmoke16> try just requiring your code before spec
<FromGitter> <Blacksmoke16> ```require "../src/atexit" ⏎ require "spec"``` [https://gitter.im/crystal-lang/crystal?at=5eb5dfd43d58de7a38038a0d]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5eb5dfe2a9de3d01b1f8fdec]
<FromGitter> <matthewmcgarvey> hmmm, it's a library so I'm not sure I can require people do that
<FromGitter> <matthewmcgarvey> It's not required so I'll have to keep thinking about it
<FromGitter> <Blacksmoke16> maybe rethink the design to not use `at_exit`?
<FromGitter> <matthewmcgarvey> that piece is to start a process that code would interact with. It's a copy from ruby's selenium library
<FromGitter> <Blacksmoke16> maybe ruby should rethink it as well 😉
<FromGitter> <Blacksmoke16> like how does the lib work, they run a `.start` method, then do stuff or?
<FromGitter> <Blacksmoke16> one option would be like
<FromGitter> <Blacksmoke16> ```run do ⏎ # User code goes here ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5eb5e21f31a6d25d7cba883e]
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5eb5e2347975db7ebff3015d]
<FromGitter> <matthewmcgarvey> You are meant to call .stop at the end. It's more of a guarantee. That's why I'm just going to leave it out. If the process is still running after it's not my fault :/
<FromGitter> <matthewmcgarvey> I was focusing on copying then improving later. That seems like it could be a possible api
<FromGitter> <matthewmcgarvey> thanks for your help!
<FromGitter> <Blacksmoke16> its a common pattern in stdlib for example to have the block be safe, but also have unsafe constructs
<FromGitter> <Blacksmoke16> like `File.new` versus `File.open do ..`
hightower2 has quit [Ping timeout: 260 seconds]
<FromGitter> <jwaldrip> I am trying to figure out how to "watch" the output of `Process.new` and raise an error if there as been no output to stdout/stderr or input to stdin within a given time. How could I go about this and ensure that the outputs still stream in realtime to the system io?
<FromGitter> <Blacksmoke16> channel with `select` and timeout?