Skip to content

POSIX process launch hides exec failures and loses the actual error #211

Closed

Description

@dimensionscape

POSIX process creation returns a process handle even when execvp fails. It also labels permission failures as command-not-found and loses errno. The caller cannot reliably distinguish a launch failure from a program that genuinely exits with code 127.

Regression coverage first: add test/regression/ProcessPosixStartError in the existing regression layout. Check that an explicit missing executable fails during creation. Extend coverage to a file without execute permission and to a real child that exits 127, which must remain a normal process result. Keep the args=null shell-command path separate from direct executable invocation.

Confirmed on Linux x86_64 with Haxe 4.3.3:

missing executable: constructor succeeded, status=127
stderr: Command not found : /no-such-libhxcpp-command
existing non-executable file: constructor succeeded, status=127
stderr: Command not found : /tmp/libhxcpp-process-audit/not-executable

In src/hx/libs/std/Process.cpp, the parent reports success as soon as fork succeeds. The child handles every execvp error by writing a prebuilt generic message and calling _exit(127). Pipe and fork failure paths also return null without preserving their reason.

Use a launch-error handshake that carries errno from the pre-exec child back to the parent, or an appropriate spawn API. Keep the child path async-signal-safe. Successful exec should close the handshake automatically, and failed launch cleanup must close all pipe ends and reap the child.

Related to #75, which addressed native Windows diagnostics. Haxe's cpp Process constructor currently discards caught native error details too, so exposing those details through sys.io.Process needs a standard-library change. NativeProcess should still retain the actual POSIX launch error.

Activity

  1. added a commit that references this issue on Oct 20, 2026
    efd92d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions