Skip to content

Conversation

bgamari
Copy link
Contributor

@bgamari bgamari commented Jan 11, 2022

In contrast to glibc, Darwin's posix_spawnp implementation doesn't set
errno on failure.

Fixes #227.

In contrast to glibc, Darwin's posix_spawnp implementation doesn't set
errno on failure.

Fixes haskell#227.
@bgamari
Copy link
Contributor Author

bgamari commented Jan 11, 2022

@angerman says that this fixes the issue for them.

@angerman
Copy link

I would say this might even fix all the other libc implementations that do not implment glibc's behaviour. E.g. BSD, Android, musl, ...

@tmcgilchrist
Copy link

This should fix FreeBSD as well based on the manpage (I don't have a FreeBSD machine to test it on)

RETURN VALUES
     Upon successful completion, posix_spawn() and posix_spawnp() return the
     process ID	of the child process to	the parent process, in the variable
     pointed to	by a non-NULL pid argument, and	return zero as the function
     return value.  Otherwise, no child	process	is created, no value is	stored
     into the variable pointed to by pid, and an error number is returned as
     the function return value to indicate the error.  If the pid argument is
     a null pointer, the process ID of the child is not	returned to the
     caller.

from https://www.freebsd.org/cgi/man.cgi?query=posix_spawn&sektion=3

OpenBSD sets an errno so the old behaviour was fine.

In case of an error, both functions may return fork() or exec() return values and set errno accordingly.

from https://man.openbsd.org/posix_spawn.3

@snoyberg snoyberg merged commit 3d9f244 into haskell:master Jan 13, 2022
snoyberg added a commit that referenced this pull request Jan 13, 2022
@snoyberg
Copy link
Collaborator

Thanks! I've merged and added a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process 1.6.13 changed observable behaviour
4 participants