Re: How to get output of piped process?

2021-03-07 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 6 March 2021 at 21:20:30 UTC, kdevel wrote: ```pipechain.d import std.stdio; import std.process; import std.conv; import std.array; import std.range; import std.algorithm; int main (string [] args) { auto p = pipe (); auto proc1 = spawnProcess (["cat"], stdin, p.writeEnd);

Re: How to get output of piped process?

2021-03-06 Thread kdevel via Digitalmars-d-learn
On Saturday, 6 March 2021 at 01:53:15 UTC, Jesse Phillips wrote: [...] I think this post is going to answer your need. https://dev.to/jessekphillips/piping-process-output-1cai I haven't read all the replies, so maybe you have it working and this will benefit someone else. If I understand you

Re: How to get output of piped process?

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 3 March 2021 at 20:43:54 UTC, Danny Arends wrote: On Monday, 22 February 2021 at 14:52:22 UTC, frame wrote: On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: https://github.com/DannyArends/DaNode/blob/master/danode/process.d Danny This example shows how easy it

Re: How to get output of piped process?

2021-03-05 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 06:58:55 UTC, Jedi wrote: I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use try wait and flush because the app is continuously

Re: How to get output of piped process?

2021-03-03 Thread Danny Arends via Digitalmars-d-learn
On Monday, 22 February 2021 at 14:52:22 UTC, frame wrote: On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: https://github.com/DannyArends/DaNode/blob/master/danode/process.d Danny This example shows how easy it is to implement a non-blocking stream. Phobos knows this for soc

Re: How to get output of piped process?

2021-03-03 Thread Danny Arends via Digitalmars-d-learn
On Tuesday, 23 February 2021 at 10:07:03 UTC, Imperatorn wrote: On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Perhaps a bit late, but this is how I deal with pipes and spawnShell. Read one byte at a time fro

Re: How to get output of piped process?

2021-03-03 Thread Danny Arends via Digitalmars-d-learn
On Thursday, 25 February 2021 at 15:28:25 UTC, kdevel wrote: On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Fortunately the D runtime /does/ take care and it throws---if the signal is ignored beforehand. I fi

Re: How to get output of piped process?

2021-02-25 Thread kdevel via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Fortunately the D runtime /does/ take care and it throws---if the signal is ignored beforehand. I filed issue 21649. [...] Perhaps a bit late, It's never to

Re: How to get output of piped process?

2021-02-23 Thread Imperatorn via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: [...] Perhaps a bit late, but this is how I deal with pipes and spawnShell. Read one byte at a time from stdout and stderr: https://github.com/DannyArends/DaNode/blob/

Re: How to get output of piped process?

2021-02-22 Thread frame via Digitalmars-d-learn
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote: https://github.com/DannyArends/DaNode/blob/master/danode/process.d Danny This example shows how easy it is to implement a non-blocking stream. Phobos knows this for sockets but not for pipes?

Re: How to get output of piped process?

2021-02-22 Thread Danny Arends via Digitalmars-d-learn
On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote: On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer wrote: [...] [...] Sure. [...] As application programmer I don't want to check any error codes. Thankfully I don't have to in D. There is a nice off-topic exampl

Re: How to get output of piped process?

2021-02-19 Thread kdevel via Digitalmars-d-learn
On Friday, 19 February 2021 at 13:42:46 UTC, Steven Schveighoffer wrote: [...] ignoring SIGPIPE is a process-wide thing, and so it's not appropriate for Phobos to make that decision for you. But it's trivial to ignore it. Sure. I've never been a fan of SIGPIPE. If you look around on the I

Re: How to get output of piped process?

2021-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/21 5:41 AM, kdevel wrote: On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote: Does your iopipe handle... Pipes? 😀 BTW: What about SIGPIPE? In an experimental code I have this    :    fout.rawWrite (buf);    fout.rawWrite ("\n");    writeln ("flushing");    fout.flush

Re: How to get output of piped process?

2021-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/21 3:37 AM, Imperatorn wrote: On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: On 2/18/21 4:40 AM, frame wrote: [...] It's just the way it is. Everything in Phobos is a C FILE * (wrapped in a File). You need to use alternative i/o systems to get the informa

Re: How to get output of piped process?

2021-02-19 Thread kdevel via Digitalmars-d-learn
On Friday, 19 February 2021 at 08:37:50 UTC, Imperatorn wrote: Does your iopipe handle... Pipes? 😀 BTW: What about SIGPIPE? In an experimental code I have this : fout.rawWrite (buf); fout.rawWrite ("\n"); writeln ("flushing"); fout.flush ();/

Re: How to get output of piped process?

2021-02-19 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: On 2/18/21 4:40 AM, frame wrote: [...] It's just the way it is. Everything in Phobos is a C FILE * (wrapped in a File). You need to use alternative i/o systems to get the information. [...] Does your iopipe handle

Re: How to get output of piped process?

2021-02-18 Thread frame via Digitalmars-d-learn
On Thursday, 18 February 2021 at 17:27:48 UTC, Steven Schveighoffer wrote: readln will block. eof doesn't tell you that there is no data in the pipe, it just says whether the pipe has been closed. Of course, I must have been thinking of another language - I should take a coffee before postin

Re: How to get output of piped process?

2021-02-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/18/21 4:40 AM, frame wrote: On Thursday, 18 February 2021 at 06:04:13 UTC, Jedi wrote: Unfortunately, std.process wraps all the pipes in File structs, so you have almost no good mechanisms to properly read the data. WTF? It's just the way it is. Everything in Phobos is a C FILE * (wra

Re: How to get output of piped process?

2021-02-18 Thread frame via Digitalmars-d-learn
On Thursday, 18 February 2021 at 06:04:13 UTC, Jedi wrote: Unfortunately, std.process wraps all the pipes in File structs, so you have almost no good mechanisms to properly read the data. WTF? -Steve I'm wonder about this message. You can always use readln() and eof() on such kind of st

Re: How to get output of piped process?

2021-02-17 Thread Jedi via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 14:36:58 UTC, Steven Schveighoffer wrote: On 2/17/21 1:58 AM, Jedi wrote: I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use tr

Re: How to get output of piped process?

2021-02-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/17/21 1:58 AM, Jedi wrote: I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use try wait and flush because the app is continuously updating the output. (it out

How to get output of piped process?

2021-02-16 Thread Jedi via Digitalmars-d-learn
I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use try wait and flush because the app is continuously updating the output. (it outputs a progress text on the same