Skip to content

os/exec: can add WaitTimeout(timeout time.Duration) bool for exec.Cmd #9580

@mei-rune

Description

@mei-rune

exec: can add WaitTimeout(timeout time.Duration) error for exec.Cmd.

example is:

    cmd := exec.Command("ping", "127.0.0.1", `-t`)
    if err := cmd.Start(); err != nil {
        log.Fatal(err)
    }
    if err := cmd.WaitTimeout(10 * time.Second); err != nil {
        log.Fatal(err)
                if err == exec.ErrTimeout {
                    cmd.Kill()
                }
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions