Commit graph

345 commits

Author SHA1 Message Date
Vladimir Panteleev
8c2b3d18fa
std.process: Explain escapeShellCommand test failures 2023-02-14 14:33:13 +00:00
Lucian Danescu
c81788f512 style fix 2022-11-12 19:40:28 +02:00
Lucian Danescu
322fed7bf7 add local imports 2022-11-12 19:29:28 +02:00
yori
b22224db3f Added @nogc to thisProcessID and thisThreadID in std.process 2022-05-16 21:21:20 +00:00
MoonlightSentinel
362e81830c
Fix 13541 - Replace usages of sysErrorString` with a helper function
`sysErrorString` throws an exception for unknown error codes (e.g. from
libraries using `SetLastError`) and hence could hide the actual error
that caused the call to `sysErrorString`.

The new helper function wraps the error code lookup and returns `Error X`
on failure.
2022-03-28 01:01:25 +02:00
MoonlightSentinel
304160f5af
Issue 13541 - Use wenforce instead of enforce + sysErrorString
This ensures that the actual error message won't be suppressed when the
lookup error code => message fails. The exception will also be more
informative because `WindowsException` is explicitly intended for
Windows API errors.
2022-03-28 01:01:19 +02:00
WebFreak001
dac59a4bde add isSomeFiniteCharInputRange as simplification
combines the very common constraint
`isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R)`
and adds a bunch of documentation with examples for users to understand
it better. This should lower the neccessary needed technical insight to
read basic docs, especially std.path and std.file docs.
2022-01-15 18:38:52 +01:00
dkorpel
ea76f45494 Use return scope instead of just return 2021-11-26 17:03:06 +01:00
dkorpel
cd7389266e Add explicit return to inout functions 2021-11-16 23:22:33 +00:00
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