How do I get the output of the time bash command?
bachmeier
no at spam.net
Wed Jan 27 13:42:28 UTC 2021
On Wednesday, 27 January 2021 at 09:58:25 UTC, Marcone wrote:
> On Wednesday, 27 January 2021 at 09:35:21 UTC, Anthony wrote:
>>
>> I'm trying to read the timed output of a pipeShell command but
>> it only results in empty output.
>>
>> Does anyone know why this is?
>>
>>
>> ```
>> auto p = pipeShell("time ls");
>>
>> foreach(str; p.stdout.byLine) {
>> writefln("%s",str);
>> }
>> ```
>
> writeln(executeShell("time ls")[1]);
This is the correct answer. The documentation for pipeShell says
> Like the functions they wrap, these functions return
> immediately, leaving the child process to execute in parallel
> with the invoking process. It is recommended to always call
> wait on the returned ProcessPipes.pid, as detailed in the
> documentation for wait.
More information about the Digitalmars-d-learn
mailing list