Skip to content

Commit 1e142ab

Browse files
committed
Merge branch 'wip/T224' of https://github.com/bgamari/process
2 parents 6f62abc + 66c26ca commit 1e142ab

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

cbits/posix/posix_spawn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <errno.h>
66
#include <signal.h>
77

8-
#if !defined(HAVE_POSIX_SPAWNP)
8+
#if !defined(USE_POSIX_SPAWN)
99
ProcHandle
1010
do_spawn_posix (char *const args[],
1111
char *workingDirectory, char **environment,

changelog.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Changelog for [`process` package](http://hackage.haskell.org/package/process)
22

3-
## Unreleased
3+
## 1.6.14.0 *February 2022*
44

55
* posix: Ensure that `errno` is set after `posix_spawnp` fails [#228](https://github.com/haskell/process/pull/228)
66
* Fix `waitForProcess` not closing process handles with `delegate_ctlc` [#231](https://github.com/haskell/process/pull/231)
7+
* Don't use `posix_spawn` on platforms where it does not report `ENOENT` in caes where the
8+
requested executable does not exist [#224](https://github.com/haskell/process/issues/224)
9+
* Ensure that `find_executable` correctly-locates executables when a change in
10+
working directory is requested [#219](https://github.com/haskell/process/issues/219)
11+
* Fix capitalization error allowing `execvpe` to be used when available.
712

813
## 1.6.13.2 *July 2021*
914

configure.ac

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@ AC_CHECK_DECLS([POSIX_SPAWN_SETPGROUP],[],[],[
3131
#include <spawn.h>
3232
])
3333

34+
if test "$ac_cv_func_posix_spawnp" = "yes"; then
35+
dnl On OpenBSD posix_spawnp doesn't report ENOENT when
36+
dnl the user attempts to spawn a process with a non-existent
37+
dnl executable. Don't attempt to use such posix_spawn
38+
dnl implementations to ensure errors are reported correctly.
39+
dnl See #224.
40+
41+
AC_MSG_CHECKING(whether posix_spawn reports errors sensibly)
42+
AC_RUN_IFELSE(
43+
[AC_LANG_PROGRAM([
44+
#include <stddef.h>
45+
#include <stdbool.h>
46+
#include <errno.h>
47+
#include <spawn.h>
48+
], [[
49+
pid_t pid;
50+
char *prog = "__nonexistent_program__";
51+
char *args[] = {prog, NULL};
52+
char *env[] = {NULL};
53+
54+
// This should fail with ENOENT
55+
int ret = posix_spawnp(&pid, prog, NULL, NULL, args, env);
56+
bool okay = ret == ENOENT;
57+
return !okay;
58+
]]
59+
)],
60+
[AC_DEFINE([USE_POSIX_SPAWN], [], [posix_spawn should be used])
61+
AC_MSG_RESULT(yes)],
62+
[AC_MSG_RESULT([no, falling back to fork/exec])]
63+
)
64+
fi
65+
66+
3467
FP_CHECK_CONSTS([SIG_DFL SIG_IGN])
3568

3669
AC_OUTPUT

process.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: process
2-
version: 1.6.13.2
2+
version: 1.6.14.0
33
-- NOTE: Don't forget to update ./changelog.md
44
license: BSD3
55
license-file: LICENSE

0 commit comments

Comments
 (0)