Re: pipeProcess not returning immediately

2017-08-26 Thread FoxyBrown via Digitalmars-d-learn

On Saturday, 26 August 2017 at 06:24:26 UTC, user1234 wrote:
On Saturday, 26 August 2017 at 01:13:35 UTC, Johnson Jones 
wrote:
I am running ffplay.exe and my application does not return 
immediately from pipeProcess. I have to close ffplay for my 
program to continue execution.


No process is asynchronous in std.process.

If you don't want to block your program then wrap it in a 
thread that checks periodically for termination.


Either you are wrong or the docks are wrong:

https://dlang.org/phobos/std_process.html

pipeProcess also spawns a child process which runs in 
**parallel** with its parent. However, instead of taking 
arbitrary streams, it automatically creates a set of pipes that 
allow the parent to communicate with the child through the 
child's standard input, output, and/or error streams. This 
function corresponds roughly to C's popen function.





Re: pipeProcess not returning immediately

2017-08-25 Thread user1234 via Digitalmars-d-learn

On Saturday, 26 August 2017 at 01:13:35 UTC, Johnson Jones wrote:
I am running ffplay.exe and my application does not return 
immediately from pipeProcess. I have to close ffplay for my 
program to continue execution.


No process is asynchronous in std.process.

If you don't want to block your program then wrap it in a thread 
that checks periodically for termination.


pipeProcess not returning immediately

2017-08-25 Thread Johnson Jones via Digitalmars-d-learn
I am running ffplay.exe and my application does not return 
immediately from pipeProcess. I have to close ffplay for my 
program to continue execution.


pipeProcess is suppose to return immediately/run asynchronously, 
and it does with ffmpeg or other programs that return. (which I 
do not know if it is returning immediately or not on those 
because they execute so quickly)


But I have a feeling it is not running asynchronously at all. Any 
ideas? This is on windows and simply calling pipeProcess directly 
with a simple "ffplay filename" example.


ffplay opens up a window showing the spectrogram while the file 
is playing. After I close it out, my app then does what it is 
suppose to. This suggests the pipeProcess is not running 
asynchronously.


void ExecuteCommand(T...)(T args)
{
foreach(t; AliasSeq!T)
static assert(is(t == string), 
typeof(this).stringof~":"~__PRETTY_FUNCTION__~" requires string 
arguments!");


			pipes = pipeProcess([args[0], (AliasSeq!args)[1..$]], 
Redirect.stdout);

}

call it like

ExecuteCommand("ffplay.exe", "test.wav");