func (c *Cmd) Clone() *Cmd {
	clone := NewCmdOptions(
		Options{
			Buffered:  c.buffered,
			Streaming: c.Stdout != nil,
		},
		c.Name,
		c.Args...,
	)
	clone.Dir = c.Dir
	clone.Env = c.Env
	return clone
}
Clone clones a Cmd. All the options are transferred,
but the internal state of the original object is lost.
Cmd is one-use only, so if you need to re-start a Cmd,
you need to Clone it.
package cmd
import (
	"bufio"
	"bytes"
	"errors"
	"fmt"
	"io"
	"os/exec"
	"sync"
	"syscall"
	"time"
)
type Cmd struct {
	Name   string
	Args   []string
	Env    []string
	Dir    string
	Stdout chan string  
	Stderr chan string  
	*sync.Mutex
	started    bool           
	stopped    bool           
	done       bool           
	final      bool           
	startTime  time.Time      
	stdout     *OutputBuffer  
	stderr     *OutputBuffer  
	status     Status
	statusChan chan Status    
	doneChan   chan struct{}  
	buffered   bool           
}
type Status struct {
	Cmd      string
	PID      int
	Complete bool      
	Exit     int       
	Error    error     
	StartTs  int64     
	StopTs   int64     
	Runtime  float64   
	Stdout   []string  
	Stderr   []string  
}
func NewCmd(name string, args ...string) *Cmd {
	return &Cmd{
		Name:     name,
		Args:     args,
		buffered: true,
		Mutex:    &sync.Mutex{},
		status: Status{
			Cmd:      name,
			PID:      0,
			Complete: false,
			Exit:     -1,
			Error:    nil,
			Runtime:  0,
		},
		doneChan: make(chan struct{}),
	}
}
type Options struct {
	Buffered bool
	Streaming bool
}
func NewCmdOptions(options Options, name string, args ...string) *Cmd {
	out := NewCmd(name, args...)
	out.buffered = options.Buffered
	if options.Streaming {
		out.Stdout = make(chan string, DEFAULT_STREAM_CHAN_SIZE)
		out.Stderr = make(chan string, DEFAULT_STREAM_CHAN_SIZE)
	}
	return out
}