Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 19 18:56
    asterite ready_for_review #12405
  • Aug 19 18:56
    asterite edited #12405
  • Aug 19 17:43
    asterite labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:38
    Blacksmoke16 labeled #12405
  • Aug 19 16:02
    asterite synchronize #12405
  • Aug 19 16:01
    asterite opened #12405
  • Aug 19 15:34
    kramerul synchronize #12404
  • Aug 19 15:23
    kramerul synchronize #12404
  • Aug 19 15:13
    kramerul synchronize #12404
  • Aug 19 15:10
    kramerul synchronize #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:08
    Blacksmoke16 labeled #12404
  • Aug 19 15:06
    wonderix opened #12404
  • Aug 19 14:20
    asterite closed #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:42
    straight-shoota milestoned #12403
  • Aug 19 12:03
    asterite synchronize #12403
  • Aug 19 11:34
    straight-shoota closed #11420
From IRC (bridge bot)
@FromIRC
<Papierkorb> Correct
Bar Hofesh
@bararchy
In that case, It should not compile and give an error that IO::Memory cannot be used with Process (no overload of...)
Ghost
@ghost~55586c4815522ed4b3e08557
right.. it's weird because there should be a copy from the process output, to the memory io..
even looking at the code I can't understand why it's not working, can't find what I'm missing here..
From IRC (bridge bot)
@FromIRC
<Papierkorb> It has no file descriptor.
Bar Hofesh
@bararchy
@bew The process needs an actual FD to write output to, it can't write to the Crystal memory buffer as it's not aware of it's existese
Ghost
@ghost~55586c4815522ed4b3e08557
I know, but there should be a pipe created, at this point: https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L224
Bar Hofesh
@bararchy
You can create a dummy FD that is piped to the IO::Memory, but then it's no longer IO::Memory , it's IO#pipe
From IRC (bridge bot)
@FromIRC
<vegai> there's no way to make operators take optional arguments, is there?
<Papierkorb> Thankfully not.
<vegai> :⁠)
kipar
@konovod

It's .. the opposite of safe

why? I thought local variables are GC'd anyway, so if there is a Slice pointing to it it won't be gone.

From IRC (bridge bot)
@FromIRC
<vegai> I'm having this problem where I'm defining / for my type, and it might be benificial to have the max precision of the operation be an optional parameter
<Papierkorb> @konovod, StaticArray lives on the stack. The GC never sees it.
Ghost
@ghost~55586c4815522ed4b3e08557
@bararchy following need_pipe? def, https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L349 an IO::Memory will return true
From IRC (bridge bot)
@FromIRC
<vegai> but perhaps I'll just define "div" to do that
Ghost
@ghost~55586c4815522ed4b3e08557
and this line https://github.com/crystal-lang/crystal/blob/master/src/process.cr#L228 should continuously copy the coming output to the memory io... no?
kipar
@konovod
@Papierkorb, oh, i see now.
Ghost
@ghost~55586c4815522ed4b3e08557
Papierkorb, sorry for direct mention, but.. can you spot what I'm missing above?
From IRC (bridge bot)
@FromIRC
<Papierkorb> @bew, from just reading those few lines, yep that needs_pipe branch should be taken
Bar Hofesh
@bararchy
So a bug then ?
Ghost
@ghost~55586c4815522ed4b3e08557
@bararchy maybe your example fails because you're not waiting for the process to finish executing, so you don't have any output yet?
Bar Hofesh
@bararchy
well
@bew Still nothing
output = IO::Memory.new
ps = Process.new("/bin/bash", output: output)
ps.wait
sleep 2
output.size
output.to_s
Ghost
@ghost~55586c4815522ed4b3e08557
well, what do you expect to have in output?
can you try with /bin/ls ?
Bar Hofesh
@bararchy
Yeha, lol, I expected for the bash to print the prompt, but not sure why it didnt, ls works, I'll close the issue
Thanks @bew
Ghost
@ghost~55586c4815522ed4b3e08557
the prompt is shown only when in interactive mode
I think
From IRC (bridge bot)
@FromIRC
<Papierkorb> Correct
From IRC (bridge bot)
@FromIRC
<marin> Hi, I have a question about my program. I have situation where I need to see class atributes in other class. Any ideas?
Serdar Dogruyol - Sedo セド
@sdogruyol
inheritance, properties?
marin117
@marin117
No inheritance, and not sending object reference to class
From IRC (bridge bot)
@FromIRC
<Groogy> do you mean like seeing the methods an object will respond to?
<Groogy> you could get a list through macros I think?
<Groogy> {% Type.methods %} I think gives you a compile time list of methods
marin117
@marin117
Well something like that
I have 2 classes, 1 is abstract and from that class I inherit other class
In those other classes I need to call 1 method from first class
From IRC (bridge bot)
@FromIRC
<Groogy> yes and?
<Papierkorb> Just call it?
marin117
@marin117
undefined method or local variable
From IRC (bridge bot)
@FromIRC
<Papierkorb> We should start something where we can accumulate standard example snippets
<Groogy> Heh to quickly paste things like this?
<Papierkorb> Yeah, it's a waste of the helpers time to write the same basic code over and over again
something like this