Skip to content

os/exec: commands cannot start with standard file descriptors on Linux and Darwin #5695

Open

Description

@yohimik

My CLI needs to run child commands and read their output. exec.Command("/bin/echo", "ok").Output() cannot do this with the current process implementation.

In dev at 93940cb6, Linux rejects ProcAttr.Files with files setting not implemented. os/exec supplies these files for standard input and output. Darwin returns not implemented. Process wait and exit status methods are also stubs. The command should return ok\n and a successful exit status.

This is a source check from 18 September 2026. #632 closed on 27 November 2024 and #4471 closed on 4 October 2025 after earlier process work. The remaining file descriptor and process state gaps need this follow-up.

#5634 contains the proposed implementation and tests. It closed on 17 September with a request for an issue. Darwin also needs #5612 and #5694 (PR #5636). Concurrent pipe and process creation needs #5692 (PR #5630). Interruptible pipe I/O and WaitDelay remain separate work.

Replacement draft PR #5699.

Activity

  1. 0pcom commented on Oct 20, 2026

    @0pcom
    Contributor

    I have a branch that fixes this on Linux: dev...0magnet:tinygo:os-exec-linux. It starts the child from C with clone(CLONE_VM|CLONE_VFORK) and implements Wait, Kill and Signal. With dev, exec.Command("echo", "hi").Output() fails with "files setting not implemented". With the branch it returns "hi\n", and a child that exits 3 reports ExitCode 3. Darwin is not covered, and I have no Mac to test on.

  2. yohimik commented on Oct 22, 2026

    @yohimik
    ContributorAuthor

    Sorry, I created MR fixes long time ago as drafts, but wasn't able to change since was under police custody, thanks #5699

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