Issue 24824 - std.process.browse returns on failure in forked child
Summary: std.process.browse returns on failure in forked child
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Linux
: P1 major
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-10-22 02:10 UTC by Steven Schveighoffer
Modified: 2024-11-17 01:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Steven Schveighoffer 2024-10-22 02:10:10 UTC
On posix platforms besides OSX, std.process.browse uses a fork/exec to open a browser window.

When this fails, it's the exec that fails. However, the function returns instead of exits. This means it keeps executing whatever it was doing in the parent process when `browse` was called! And with only one thread, with everything else in the process still allocated/opened.

This is disastrous. The process should exit right away.

Technically this should be redone to use std.process utilities directly, but I just want to make sure this bug is fixed, so I'm making a separate bug.

I'll open a separate issue on the enhancement to replace browse internals with std.process regular functions. That originally was captured in issue 6496, but that was closed incorrectly.
Comment 1 Dlang Bot 2024-10-22 02:25:22 UTC
@schveiguy updated dlang/phobos pull request #9065 "Fix issue 24824 - ensure we exit a child that does not succeed in exec." fixing this issue:

- Fix Bugzilla Issue 24824 - ensure we exit a child that does not succeed in exec.

https://github.com/dlang/phobos/pull/9065
Comment 2 Steven Schveighoffer 2024-10-22 04:12:57 UTC
Note, I guess OSX is included here, but `open` always exists, so you wouldn't ever see this issue.
Comment 3 Dlang Bot 2024-10-22 07:10:31 UTC
dlang/phobos pull request #9065 "Fix issue 24824 - ensure we exit a child that does not succeed in exec." was merged into stable:

- 3c9ba2b6a4333ad171a617e265dd577dec2f015f by Steven Schveighoffer:
  Fix Bugzilla Issue 24824 - ensure we exit a child that does not succeed in exec.

https://github.com/dlang/phobos/pull/9065
Comment 4 Dlang Bot 2024-11-17 01:03:59 UTC
dlang/phobos pull request #9086 "Merge stable" was merged into master:

- 10076badd83324c84931cf599a14059f3a298694 by Steven Schveighoffer:
  Fix Bugzilla Issue 24824 - ensure we exit a child that does not succeed in exec. (#9065)

https://github.com/dlang/phobos/pull/9086