Any reason why execute() delays?

bauss jj_1337 at live.dk
Mon Jul 27 19:13:00 UTC 2020


On Monday, 27 July 2020 at 17:33:23 UTC, Dukc wrote:
> I know this is probably abusing D, but I wrote this:
>
> ```
> enum bridgePath = <path to bridge.exe>;
>
> int main(string[] args)
> {  import std.process, std.stdio;
>    auto result = execute(["wine", bridgePath] ~ args[1 .. $]);
>    result.output.write;
>    return result.status;
> }
> ```
>
> However, for some strange reason this one adds up to around 3 
> seconds of delay when invoked, compared to invoking `wine 
> bridge.exe <args>` directly. If I instead write
>
> ```
> int main(string[] args)
> {  import std.process;
>    return spawnProcess(["wine", bridgePath] ~ args[1 .. 
> $]).wait;
> }
> ```
>
> the delay disappears. Does anybody know why?

Probably because execute() will also collect output etc. so maybe 
initializing that adds the delay whereas spawnProcess will just 
spawn the process and nothing else.


More information about the Digitalmars-d mailing list