## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
• Create your own community
##### Activity
• 04:15
postmodern edited #11755
• 03:43
postmodern labeled #11755
• 03:43
postmodern opened #11755
• Jan 19 22:41
straight-shoota edited #11715
• Jan 19 22:37
straight-shoota synchronize #11715
• Jan 19 22:35
straight-shoota review_requested #11716
• Jan 19 22:35
straight-shoota synchronize #11715
• Jan 19 22:32
straight-shoota synchronize #11715
• Jan 19 16:05
yxhuvud synchronize #11754
• Jan 19 11:58
yxhuvud opened #11754
• Jan 18 22:28
straight-shoota closed #11751
• Jan 18 17:33
straight-shoota milestoned #11751
• Jan 18 16:48
Blacksmoke16 labeled #11753
• Jan 18 16:42
yxhuvud labeled #11753
• Jan 18 16:42
yxhuvud opened #11753
• Jan 18 13:52
straight-shoota synchronize #11751
• Jan 18 13:34
HertzDevil opened #11752
• Jan 18 13:34
HertzDevil labeled #11752
• Jan 18 13:34
HertzDevil labeled #11752
• Jan 18 13:34
HertzDevil labeled #11752
George Dietrich
@Blacksmoke16
just so that it would print the generated code to stdout
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Damn, that's nice! Would have helped when I struggled with macros xD
George Dietrich
@Blacksmoke16
indeed :P super helpful
oprypin
@oprypin:matrix.org
[m]
hmm I'm having real difficulties coming purely from the fact that STDOUT is a constant although it doesn't have to be
ddd
@Dan-Do
It seems I cannot subtract 2 arrays
ary1 = [[2,3,4], [1,2,3]]
ary2 = [1,2,3]
pp! ary1 - ary2 # return ary1
ddd
@Dan-Do
Edit: I used it wrong. Should be ary2 = [[1,2,3]]
oprypin
@oprypin:matrix.org
[m]
yep, i straight up had to hack into the memory region that stores STDOUT
https://gist.github.com/cec2361269f965985fda49a78a3c80f2
From IRC (bridge bot)
@FromIRC
<yxhuvud> in Ruby there is both \$stdout and STDOUT, where the difference is that one is the canonical stdout and one is possible to reassign. perhaps something similar would be a good idea?
Paulo Coghi
@paulocoghi
Has anyone successfully used github.com/naqvis/webview on Linux?
I can't run the simple examples, even after installing the required libs: naqvis/webview#4
Paulo Coghi
@paulocoghi
Since the original library works normally on my machine (compilation and execution of the C, C++ and even Go versions), I will try to recreate the Crystal binding. Wish me luck :smile:
oprypin
@oprypin:matrix.org
[m]
yxhuvud, it would certainly be a good idea, just that there are no globals
From IRC (bridge bot)
@FromIRC
<yxhuvud> perhaps better to build an api for temporary replacement for the three std ios. It may be reasonable to have some minor specializations on those 3.
oprypin
@oprypin:matrix.org
[m]

yxhuvud, it would also hugely help to allow these to be any IO, not only FileDescriptor. almost all of the complexity is also due to that.

https://gist.github.com/cec2361269f965985fda49a78a3c80f2

From IRC (bridge bot)
@FromIRC
<yxhuvud> well they can't be IO::Memory - they need to be backed by a file descriptor.
oprypin
@oprypin:matrix.org
[m]
yxhuvud, they can be IO anything which eventually calls to that FD-backed one
not even necessarily, if you purely want to intercept it
From IRC (bridge bot)
@FromIRC
<yxhuvud> well you'd need a pipe or whatever in between
oprypin
@oprypin:matrix.org
[m]
not for the stdout case
it's all programmatic. any write call gets rewritten to a different write call and that's it
and i know about pipes because i certainly needed them in this latest example
From IRC (bridge bot)
@FromIRC
<yxhuvud> unless you want to keep it compatible wth c extensions or whatever, but yeah
oprypin
@oprypin:matrix.org
[m]
ah yea for stuff that directly accesses STDOUT descriptor then you probably need reopen into a pipe
but i think avoiding a pipe+fiber is a more worthy goal than catering to stuff that bypasses official interfaces
From IRC (bridge bot)
@FromIRC
<yxhuvud> both would probably be nice to have. for example to redirect std output for a c extension to avoid spamming the terminal
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Hello there! How can I force some method override to take over something else?
George Dietrich
@Blacksmoke16
define it after the one you want to override
From IRC (bridge bot)
@FromIRC
<SamantazFox_> the problem is that I want to intercept an exception, but I'd like to not have a duplicate of the stdlib for a single line of code
George Dietrich
@Blacksmoke16
feels hacky to override stuff like this
could you not use a HTTP::Handler for this?
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Idk, tbh
<SamantazFox_> I'm entirely open to suggestions!
<SamantazFox_> " You can use a handler to intercept any incoming request and can modify the response. These can be used for request throttling, ip-based filtering, adding custom headers e.g. <code>"
<SamantazFox_> Hmm, but when is it called?
George Dietrich
@Blacksmoke16
that would work, but also would globally silence both of those exceptions, even if they arent from that specific context in your PR
whats the reason these exceptions are being thrown? would it be better to fix the root cause versus just hiding the issue?
From IRC (bridge bot)
@FromIRC
<SamantazFox_> The root cause is simply the user aborting the page loading
<SamantazFox_> they reach <domain>/some/path and either click on a link or on the "Stop" button near the URL bar while the page is still loading.
George Dietrich
@Blacksmoke16
hmm
From IRC (bridge bot)
@FromIRC
<SamantazFox_> crystal-lang/crystal#9065
<SamantazFox_> Here's the issue about that problem ^
<SamantazFox_> That wouldn't be much of a problem if that didn't fill up the logs every time a user is impatient...
George Dietrich
@Blacksmoke16
could just silence the logs from stdlib http stuff
based on https://github.com/crystal-lang/crystal/issues/9065#issuecomment-613559889, id be curious to see if you can reproduce on a simple endpoint or something
From IRC (bridge bot)
@FromIRC
<SamantazFox_> it doesn't happen with a small payload (it's probably being buffered or something)
From IRC (bridge bot)
@FromIRC
<SamantazFox_> (I've tried to delay the response as proposed here: https://github.com/crystal-lang/crystal/issues/9065#issuecomment-961489274, but the browser doesn't seem to time out for localhost)
From IRC (bridge bot)
@FromIRC
<SamantazFox_> Yep, confirmed: Firefox and Vivaldi don't timeout on localhost.
George Dietrich
@Blacksmoke16
SamantazFox_: reproducible example would be super helpful id say
From IRC (bridge bot)
@FromIRC
<SamantazFox_> I'll see that tomorrow. I'mm too tipsy to do anything rn x)