Commit graph

336 commits

Author SHA1 Message Date
Andrei Alexandrescu
bd19a80b8f Replace lsof failure with warning for CI's sake 2021-10-22 21:53:40 +00:00
Paul Backus
3ad8dbd41c Check return value of 'open' in std.process test
Previously, if this call to 'open' failed, it would result in a spurious
test failure. Now, it instead causes the test to be skipped.

Possibly related to https://issues.dlang.org/show_bug.cgi?id=22350
2021-10-03 22:35:00 +00:00
Per Nordlöw
52304683d7 Improve searchPathFor 2021-09-25 01:47:13 +02:00
Hiroki Noda
e1bb58a742 rendered in red warning 2021-08-26 22:34:51 +09:00
Hiroki Noda
1aad510fb3 Note that all of the code in preExecFunction must be async-signal-safe 2021-08-26 21:52:14 +09:00
Martin Nowak
df280fd7ab Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-07-20 10:54:24 +02:00
Vladimir Panteleev
baf6ede6de
Fix Issue 22125 - std.process.Config was changed to a struct but miss operator overloads 2021-07-15 12:17:39 +00:00
dkorpel
9ec24190b1 add explicit scope/return for pure functions 2021-07-11 13:34:25 +00:00
Walter Bright
74a40f4783 add @trusted for scope pointer to scope pointer 2021-05-31 00:45:26 +02:00
nordlow
db6a3ac21c Annotate std/process.d to please dlang/dmd#12520 2021-05-17 19:00:50 +08:00
Iain Buclaw
859a367ffa Cleanup temp files in std.process and std.experimental.checkedint
Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
2021-05-14 15:03:34 +02:00
Martin Nowak
0f71d7494f Merge remote-tracking branch 'upstream/master' into stable 2021-05-12 08:29:15 +02:00
Iain Buclaw
567b2d716f std.process: Add scope to pipeProcessImpl command parameter 2021-05-03 11:46:50 +02:00
MoonlightSentinel
fa905436d9
Make std.process.browse @safe and sync attributes for windows/posix
Add `@trusted` wrappers for calls to C functions that are always
called with valid arguments.
2021-04-27 10:57:43 +02:00
Nicholas Wilson
2d9e4e2717
Merge branch 'master' into merge_stable 2021-04-27 16:28:29 +08:00
MoonlightSentinel
9d5db86e9d Issue 20257 - Add wait(Pid, Duration) for windows
`wait(Pid, Duration)` allows to wait until the process terminates
or the timeout expires.

It's currently windows-only because a decent posix implementation
is quite difficult and this allows us to sort out the API beforehand.
2021-04-26 17:37:06 +02:00
Martin Nowak
dd2dc35c31 Merge remote-tracking branch 'upstream/stable' into merge_stable 2021-04-25 21:19:23 +02:00
MoonlightSentinel
d186363752
Merge OSX and Posix implementations of browse
They are identical except their usage of open vs. xdg-open
2021-04-21 10:42:38 +02:00
MoonlightSentinel
08927149cc
Fix 20886 - Retain tempCString buffer in browse
The temporary buffer returned by `tempCString` was assigned to a `char*`
and hence destroyed after the statement. This worked by accident for
small URL's because the space was allocated on the stack and not
overwritten before forking.
2021-04-21 10:28:41 +02:00
Tomoya Tanjo
7b4a336bf7
Fix issue 21575 - Child processes spawned by std.process.spawnProcess accidentally inherit signal masks in parent process (#7766)
Fix issue 21575 - Child processes spawned by std.process.spawnProcess accidentally inherit signal masks in parent process
merged-on-behalf-of: unknown
2021-04-19 17:58:16 +02:00
Iain Buclaw
c6c8b12852 Implement missing OpenBSD ports in phobos 2021-02-01 18:46:54 +01:00
Vladimir Panteleev
05ab29770c
std.process: Simplify error message generation on Windows
Based on #7394 and as discussed in #7726.
2020-12-17 17:43:05 +00:00
Vladimir Panteleev
5cc514835a
std.process: Improve searchPathFor
- Make @safe
- Reduce allocations
2020-12-17 17:43:05 +00:00
Vladimir Panteleev
cca9f214cc
std.process: Make isExecutable accept a range 2020-12-17 17:43:05 +00:00
Vladimir Panteleev
3b0aad98a1
std.process: Refactor environment
- Perform idup caching on all platforms (on Windows it also avoids
  eliding conversion to UTF-8)

- Make getImpl more reusable

- Reduce redundancy between get / opIndex
2020-12-17 17:43:05 +00:00
Vladimir Panteleev
de8207f62d
std.process: Remove unfixable TODO
Environment.remove cannot be @safe due to its use of the C functions
SetEnvironmentVariableW and unsetenv, and doesn't have sufficient
functionality to encapsulate the non-@safe fragments.
2020-12-17 17:43:05 +00:00
Vladimir Panteleev
cdd9824531
std.process: Remove unnecessary @trusted 2020-12-17 17:43:05 +00:00
Vladimir Panteleev
5226ec2ba3
std.process: Rename spawnProcessImpl to spawnProcessWin / Posix
Improve code clarity and remove platform-specific "overloads" with
functions with the same name but different argument lists.
2020-12-17 16:47:08 +00:00
Martin Kinkelin
7f0bd1526a std.process: Include program name in exception msg if it cannot be found
On Windows, the message for this common error case wasn't as informative
as it should be:

Failed to spawn new process (The system cannot find the file specified.)

Handle this just like on POSIX via a message like:

Executable file not found: 7z.exe

Also include the program name on POSIX if it contains a path (a dir
separator) - `Failed to execute program (No such file or directory)` =>
`Failed to execute './program' (No such file or directory)`.
2020-12-17 16:15:23 +01:00
Martin Kinkelin
fd9f853976 Fix little unittest compilability regression for iOS-derived targets
The std.process.uniqueTempPath() helper is needed for a
std.experimental.checkedint unittest.
2020-12-04 00:07:31 +01:00
Andrei Alexandrescu
9852c1ce41 Review 2020-09-21 16:11:17 -04:00
Andrei Alexandrescu
88568f7ffe Try a different syntax for echo 2020-09-21 14:01:01 -04:00
Andrei Alexandrescu
986b8202ec Use std.ascii.newline 2020-09-20 23:55:07 -04:00
Andrei Alexandrescu
c41ec6f560 Do the right thing and verify the stderr output 2020-09-20 20:13:39 -04:00
Andrei Alexandrescu
5da48602d8 Use redirection of stderr to null 2020-09-20 13:57:42 -04:00
Andrei Alexandrescu
e28ac3c61d EASY: obey the rule of silence. 2020-09-19 22:48:09 -04:00
Vladimir Panteleev
90261c1e19 Fix Issue 20984 - Heisenbug: FreeBSD64 Phobos random test suite failure in std/process 2020-08-11 19:40:59 +02:00
Vladimir Panteleev
e2fc53f405 Fix Issue 20765 - Can't run processes with relative paths when specifying a working directory
Remove the dubious check which attempted to duplicate the operating
system's behavior.
2020-08-10 20:43:45 +02:00
Geod24
04f3979317 Replace 'Issue XXX' with Bugzilla links
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Jacob Carlborg
280f3fce87 Disable most of std.process on iOS derived platforms
A process does not have permission to create new processes on
iOS derived platforms.
2020-03-03 12:51:07 +01:00
Vladimir Panteleev
2b86fe1ff9
Fix Issue 20521 - Checking for and getting empty variables on Wine / XP fails
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48471
2020-01-21 15:07:43 +00:00
Alexandru Militaru
bb62aaca3d Replaced version (unittest) with version (StdUnittest) to avoid unnecessary overhead when compiling with -unittest 2020-01-19 14:05:17 +02:00
Alexandru Militaru
d3e1bb0cdb Some version (unittest) blocks removed 2020-01-06 17:53:09 +02:00
Ali Akhtarzada
ca4ac2c158 Make Pid.osHandle nogc 2019-11-23 17:02:52 +01:00
Bernhard Seckinger
97abb91952 Fix Issue 10902 - some phobos unittests take an excessive amount of time 2019-11-12 20:21:03 +01:00
Hiroki Noda
682544575f std.process: use local imports
In current phobos policy, local imports should be preferred over global
imports.
2019-08-21 09:35:00 +09:00
Hiroki Noda
c25c94bb47 std.process: add missing check for failed malloc() (#7116)
std.process: add missing check for failed malloc()
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-08-20 12:34:52 +02:00
Hiroki Noda
8dc81bb83f Add comment for using non async-signal-safe function 2019-07-25 09:23:24 +09:00
JinShil
3ca8d026b7 std.process.forkChild cannot be inlined 2019-06-05 22:04:56 +09:00
John Colvin
85adbf1133
core.stdc.stdlib._Exit not core.stdc.stdlib._exit 2019-02-25 17:53:59 +00:00