Skip to content

Could not read from pipe to get child status (Interrupted system call) #10884

@CyberShadow

Description

@CyberShadow

If the program receives a signal (e.g. SIGALARM) just as std.process is creating a new process, the operation may fail with:

std.process.ProcessException@std/process.d(1162): Could not read from pipe to get child status (Interrupted system call)
----------------
??:? @trusted std.process.Pid std.process.spawnProcessPosix(scope const(char[])[], std.stdio.File, std.stdio.File, std.stdio.File, scope const(immutable(char)[][immutable(char)[]]), std.process.Config, const(char)[]) [0x9266bc]
??:? @safe std.process.Pid std.process.spawnProcess(scope const(char[])[], std.stdio.File, std.stdio.File, std.stdio.File, const(immutable(char)[][immutable(char)[]]), std.process.Configconst , char[]) [0x925d01]
??:? @trusted std.process.Pid std.process.spawnProcess(scope const(char[])[], const(immutable(char)[][immutable(char)[]]), std.process.Config, const(char)[]) [0x925ee6]
...

However, the correct thing to do when a system call is interrupted by EINTR is to retry it (a very annoying part of POSIX but I think in general it has to be done with all interruptible system calls).

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