ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
postmodern has joined #crystal-lang
<postmodern> is there an example of using Process.run and reading stdout of the process? having trouble using it with `output:` and `IO::Memory.new`
<postmodern> also is there a way to do full streaming I/O from the process. I don't want to read the entire stdout once the process has exited, but read it as output is received.
ur5us has joined #crystal-lang
ejjfunky has joined #crystal-lang
<FromGitter> <Blacksmoke16> postmodern: read std while the process is running, or to STDOUT, or to some other io?
<FromGitter> <Blacksmoke16> because if you the block version of `.run`, you can have access to it while its running, or when using the non block version can set `output: :inherit` to use IO of parent process (stdout), or to an `IO` instance
<FromGitter> <Blacksmoke16> ah based on your 2nd line, sounds like you want the block version
ejjfunky2 has joined #crystal-lang
ejjfunky has quit [Ping timeout: 240 seconds]
<postmodern> i kind of wish Process had a .popen method that made this task easier to do in one method call
<FromGitter> <Blacksmoke16> Got an example of what you want to do?
<postmodern> `Process.run(command) { |process| process.stdout.each_line { |line| ... } }`
<postmodern> er `Process.popen(command) { |process| process.stdout.each_line { |line| ... } }`
<postmodern> it would be nice if the stdout IO object would be created for you instead of being passed in as an argument
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=621452c88db2b95f0a33fac1]
waleee has quit [Ping timeout: 252 seconds]
<postmodern> ah `output: :pipe` is what i want, thanks
<postmodern> i still think a `.popen` method that simply sets `output: :pipe`, etc, would be helpful since `popen` is a pretty common function
<FromGitter> <moe:busyloop.net> i think it's mostly a matter of improving the docs (more examples). i've used `Process` fairly extensively and until now had no idea you could do the above either 🤷‍♂️
ur5us has quit [Ping timeout: 240 seconds]
<postmodern> hmm is there no `IO#read : String` method? These specs I'm porting to Crystal use it to verify the IO stream from the Process.run command
postmodern has quit [Remote host closed the connection]
<FromGitter> <moe:busyloop.net> there is `read_string`
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
xiamx has quit [Quit: You have been kicked for being idle]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Quit: taupiqueur]
taupiqueur has joined #crystal-lang
notzmv has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
waleee has joined #crystal-lang
waleee has quit [Ping timeout: 240 seconds]
ejjfunky2 has quit [Ping timeout: 256 seconds]
taupiqueur has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 250 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Read error: Connection reset by peer]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Ping timeout: 256 seconds]
taupiqueur has joined #crystal-lang
taupiqueur has quit [Client Quit]
taupiqueur has joined #crystal-lang
ur5us has joined #crystal-lang
sorcus has quit [Quit: WeeChat 3.4]
waleee has joined #crystal-lang
oprypin has quit [Ping timeout: 250 seconds]
sorcus has joined #crystal-lang
taupiqueur has quit [Read error: Connection reset by peer]
taupiqueur has joined #crystal-lang
FromGitter has quit [Read error: Connection reset by peer]
oprypin has joined #crystal-lang
FromGitter has joined #crystal-lang
taupiqueur has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 240 seconds]
ejjfunky0 has quit [Remote host closed the connection]
ejjfunky2 has joined #crystal-lang
ejjfunky has joined #crystal-lang
void09 has quit [Quit: void09]
void09 has joined #crystal-lang