Closed tokuhirom closed 3 months ago
posix_spawn
errno is already checked via the .check
extension function.
There are 2 stages to how the system executes posix_spawn
, the first of which returns an immediate error and sets errno
. If there is a failure after that (indicative of pid
being -1
), there is no way to determine what that error was attributed to, thus the message of "Bad arguments?".
Looking at the code though, I do see an issue that could be improved upon which will open a separate issue ticket for.
What was the command and arguments you were running, and what platform?
EDIT: See https://man7.org/linux/man-pages/man3/posix_spawn.3.html for more on how it works, specifically the RETURN VALUE
section
The current implementation at PlatformBuilder.kt:165 shows the error message "io.matthewnelson.kmp.file.IOException: posix_spawn failure in pre-exec/exec step. Bad arguments?" on error. This message is not very informative and makes it difficult to debug the issue.
I suggest enhancing the error message by using
strerror
to get the specific error information when an error occurs. This will provide more detailed information about the cause of the error, making it easier to identify and fix the problem.Proposed Change: Update the error handling to include
strerror
for more informative error messages. For example:This change will help developers better understand the nature of the error and take appropriate action to resolve it.
Thank you for considering this improvement.