Skip to content

jmervine/exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golang: jmervine/exec

GoDoc Build Status

import "github.com/jmervine/exec"

// or with versioning
import "gopkg.in/jmervine/exec.v2"

Basic Usage

if out, err := exec.X("echo foo"); err != nil {
    println(out)
}

if out, err := exec.ExecTee(io.Stdout, "echo", "foo"); err != nil {
    process(out)
}

if wait, err := exec.Fork("echo", "foo"); err != nil {
    println("waiting...")
    if out, err := wait(); err != nil {
        println(string(out))
    }
}

if wait, err := exec.ForkTee(io.Stdout, "echo", "foo"); err != nil {
    println("waiting...")
    if out, err := wait(); err != nil {
        process(out)
    }
}

// Fire and forget.
exec.Fork("bash", "./main.sh") // Note: this doesn't stream
                               // to os.Stdout with ForkTee