phobos icon indicating copy to clipboard operation
phobos copied to clipboard

std.process.browse should use internal functions for executing subprocess

Open dlangBugzillaToGithub opened this issue 1 year ago • 3 comments

schveiguy (@schveiguy) reported this on 2024-10-22T02:14:00Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24825

Description

The browse function predates std.process, and uses its own mechanisms to create a process. This resulted in at least one bug (issue 24824).

The internals should just call `spawnProcess` or whatever it takes to properly execute the browser process, instead of reimplementing most of it.

dlangBugzillaToGithub avatar Oct 22 '24 02:10 dlangBugzillaToGithub

schveiguy (@schveiguy) commented on 2024-10-22T02:30:55Z

Note, this is a "reopening" of issue 6496. I think that was closed in error.

dlangBugzillaToGithub avatar Oct 22 '24 02:10 dlangBugzillaToGithub

As noted in #10696, an implementation of this idea in Phobos v2 would have maintain its @nogc attribute for compatibility reasons. spawnProcess currently makes use of the GC.

Chances are this might be a better fit for Phobos v3.

0xEAB avatar Mar 24 '25 03:03 0xEAB

As spawnProcess returns a class instance, the only option is to use private internal functions to do this. But likely those also are going to do some allocations.

schveiguy avatar Mar 25 '25 15:03 schveiguy