diff options
Diffstat (limited to 'golib/eows/eows.go')
-rw-r--r-- | golib/eows/eows.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/golib/eows/eows.go b/golib/eows/eows.go index a5767ed..192be3d 100644 --- a/golib/eows/eows.go +++ b/golib/eows/eows.go @@ -28,6 +28,10 @@ const ( SplitLine SplitType = iota // SplitChar Split character by character SplitChar + // SplitLineTime Split by line or until a timeout has passed + SplitLineTime + // SplitTime Split until a timeout has passed + SplitTime ) // Inspired by : @@ -51,6 +55,7 @@ type ExecOverWS struct { ExitCB EmitExitCB // exit proc callback UserData *map[string]interface{} // user data passed to callbacks OutSplit SplitType // split method to tokenize stdout/stderr + LineTimeSpan int64 // time span (only used with SplitTime or SplitLineTime) // Private fields proc *os.Process @@ -67,8 +72,9 @@ func New(cmd string, args []string, so *socketio.Socket, soID, cmdID string) *Ex SocketIO: so, Sid: soID, CmdID: cmdID, - CmdExecTimeout: -1, // default no timeout - OutSplit: SplitChar, // default split by character + CmdExecTimeout: -1, // default no timeout + OutSplit: SplitLineTime, // default split by line with time + LineTimeSpan: 500 * time.Millisecond.Nanoseconds(), } cmdIDMap[cmdID] = e |