Re: D: How do I pipe (|) through three programs using std.process?

2023-11-19 Thread kdevel via Digitalmars-d-learn
On Saturday, 18 November 2023 at 18:09:53 UTC, BoQsc wrote: Latest iteration on this thread. Limitations: * pipes through two programs. * very verbose, hard to use. What exactly are you trying to achieve? ``` import std; import std.process; version (Windows) { enum Find = "find"; }

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-18 Thread BoQsc via Digitalmars-d-learn
Latest iteration on this thread. Limitations: * pipes through two programs. * very verbose, hard to use. ``` import std; import std.process; version (Windows) { enum Find = "find"; } version (Posix) { enum Find = "grep"; } void pipeTo(Pipe p, string nextprogram){

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-14 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 11 November 2023 at 17:29:14 UTC, BoQsc wrote: https://dlang.org/library/std/process.html How do I pipe (|) through three programs using std.process? https://dev.to/jessekphillips/piping-process-output-1cai Your issue with [Find, "Hello"] might be [Find, "\"Hello\""] But I'm

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-12 Thread BoQsc via Digitalmars-d-learn
To make this thread more complete, here is the final version. ``` import std.stdio; import std.process; version (Windows) { enum Find = "find"; } version (Posix) { enum Find = "grep"; } int main (string [] args) { auto p1 = pipe; auto p2 = pipe; auto pid1 = spawnShell("echo

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-12 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 12 November 2023 at 13:39:25 UTC, BoQsc wrote: However the question of why `spawnProcess(["find", "string to find"]` is not working and produces error is still unresolved. spawnProcess always encodes its arguments in a very specific way and the receiving programs are not always

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-12 Thread BoQsc via Digitalmars-d-learn
Using `spawnShell` it all seem to work. However the question of why `spawnProcess(["find", "string to find"]` is not working and produces error is still unresolved. Works with `spawnShell`: ``` import std.stdio; import std.process; version (Windows) { enum Find = "find"; } version (Posix) {

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-12 Thread BoQsc via Digitalmars-d-learn
On Windows: While trying to use `spawnshell` I discovered that I can not use any alphabetical letters inside the `spawnProcess([Find, "Hello"])` it all works when they are numerical `[Find, "6515"]`. As of recent testing `[Find, "df123"]` also is acceptable, but not when letter is on the

Re: D: How do I pipe (|) through three programs using std.process?

2023-11-11 Thread kdevel via Digitalmars-d-learn
On Saturday, 11 November 2023 at 17:29:14 UTC, BoQsc wrote: https://dlang.org/library/std/process.html How do I pipe (|) through three programs using std.process? ``` echo This is a sample text | find "sample" | find "text" ``` ```d import std.stdio; import std.process; version (Windows) {