Documentation ¶
Index ¶
- Constants
- Variables
- func Run(opts *Options, cancel chan struct{}, chCmdStr chan string) (chan *Command, chan string, chan int, chan int)
- func Run4Output(opts *Options, cancel chan struct{}, chCmdStr chan string) (chan string, chan string, chan int, chan int)
- type ChildCheckRecord
- type Command
- type ImmediateLineWriter
- type ImmediateWriter
- type IntSet
- type Options
- type ProcessRecord
- type TopLevelEnum
Constants ¶
Variables ¶
View Source
var ChildMarker string = strconv.Itoa(os.Getpid()) + "_" + strconv.FormatInt(time.Now().Unix(), 16)
pid_numSecondsSinceEpoch
View Source
var ErrCancelled = fmt.Errorf("cancelled")
ErrCancelled means command being cancelled
View Source
var ErrTimeout = fmt.Errorf("time out")
ErrTimeout means command timeout
View Source
var Log *logging.Logger
Log is *logging.Logger
View Source
var OutputChunkSize = 16384 // 16K
OutputChunkSize is buffer size of output string chunk sent to channel, default 16K.
View Source
var Procd string
View Source
var TmpOutputDataBuffer = 1048576 // 1M
TmpOutputDataBuffer is buffer size for output of a command before saving to tmpfile, default 1M.
View Source
var Verbose bool
Verbose decides whether print extra information
Functions ¶
Types ¶
type ChildCheckRecord ¶ added in v0.4.0
type ChildCheckRecord struct {
// contains filtered or unexported fields
}
type Command ¶
type Command struct { ID uint64 // ID Cmd string // command Cancel chan struct{} // channel for close Timeout time.Duration // time out Ch chan string // channel for stdout Err error // Error Duration time.Duration // runtime Executed chan int // for checking if the command has been executed // contains filtered or unexported fields }
Command is the Command struct
func NewCommand ¶
NewCommand create a Command
type ImmediateLineWriter ¶ added in v0.4.0
type ImmediateLineWriter struct {
// contains filtered or unexported fields
}
ImmediateLineWriter is safe to use concurrently
func NewImmediateLineWriter ¶ added in v0.4.0
func (*ImmediateLineWriter) WritePrefixedLines ¶ added in v0.4.0
func (lw *ImmediateLineWriter) WritePrefixedLines(input string, outfh *os.File)
type ImmediateWriter ¶ added in v0.4.0
type ImmediateWriter struct {
// contains filtered or unexported fields
}
func NewImmediateWriter ¶ added in v0.4.0
func NewImmediateWriter(lineWriter *ImmediateLineWriter, fh *os.File) *ImmediateWriter
type IntSet ¶ added in v0.4.0
type IntSet struct {
// contains filtered or unexported fields
}
from https://softwareengineering.stackexchange.com/questions/177428/sets-data-structure-in-golang
type Options ¶
type Options struct { DryRun bool // just print command Jobs int // max jobs number ETA bool // show eta ETABar *pb.ProgressBar KeepOrder bool // keep output order Retries int // max retry chances RetryInterval time.Duration // retry interval OutFileHandle *os.File // where to send stdout ErrFileHandle *os.File // where to send stderr ImmediateOutput bool // print output immediately and interleaved ImmediateLock sync.Mutex // make immediate output thread-safe and do one write at a time PrintRetryOutput bool // print output from retries Timeout time.Duration // timeout StopOnErr bool // stop on any error NoStopExes []string // exe names to exclude from stop signal NoKillExes []string // exe names to exclude from kill signal CleanupTime time.Duration // time to allow children to clean up PropExitStatus bool // propagate child exit status RecordSuccessfulCmd bool // send successful command to channel Verbose bool }
Options contains the options
type ProcessRecord ¶ added in v0.4.0
type ProcessRecord struct {
// contains filtered or unexported fields
}
type TopLevelEnum ¶ added in v0.4.0
type TopLevelEnum int
const ( NotTopLevel TopLevelEnum = 0 TopLevel TopLevelEnum = 1 )
Click to show internal directories.
Click to hide internal directories.