summaryrefslogtreecommitdiffstats
path: root/golib/eows/eows-in.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2019-04-04 23:45:56 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2019-04-04 23:45:56 +0200
commit89ea6ebd3671e6ebbf6101525a5416427806f318 (patch)
tree5db52146365a9c2c439b77485f938cc8c2e3a727 /golib/eows/eows-in.go
parentee147062c3bebed83e34bf5ce71019c95f62b96f (diff)
Fixed package tree and go mod filev0.5.0
Change-Id: I1047094d5b80d0622e2c2ce674979f18207b8c0f Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'golib/eows/eows-in.go')
-rw-r--r--golib/eows/eows-in.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/golib/eows/eows-in.go b/golib/eows/eows-in.go
deleted file mode 100644
index 5e74c76..0000000
--- a/golib/eows/eows-in.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package eows
-
-import (
- "fmt"
- "os"
- "syscall"
- "time"
-)
-
-// DoneChan Channel used to propagate status+error on command exit
-type DoneChan struct {
- status int
- err error
-}
-
-// pumpStdin is in charge of receive characters and send them to stdin
-func (e *ExecOverWS) pumpStdin(inw *os.File) {
-
- done := make(chan DoneChan, 1)
-
- if e.InputEvent != "" && e.InputCB != nil {
-
- err := (*e.SocketIO).On(e.InputEvent, func(stdin []byte) {
- in, err := e.InputCB(e, stdin)
- if err != nil {
- e.logDebug("Error stdin: %s", err.Error())
- inw.Close()
- return
- }
- if _, err := inw.Write(in); err != nil {
- e.logError("Error while writing to stdin: %s", err.Error())
- }
- })
- if err != nil {
- e.logError("Error stdin on event: %s", err.Error())
- }
- }
-
- // Monitor process exit
- go func() {
- status := 0
- sts, err := e.proc.Wait()
- if !sts.Success() {
- s := sts.Sys().(syscall.WaitStatus)
- status = s.ExitStatus()
- }
- e.procExited = true
-
- done <- DoneChan{status, err}
- }()
-
- // Wait cmd complete
- select {
- case dC := <-done:
- e.ExitCB(e, dC.status, dC.err)
- case <-time.After(time.Duration(e.CmdExecTimeout) * time.Second):
- e.ExitCB(e, -999, fmt.Errorf("Exit Timeout for command ID %v", e.CmdID))
- }
-}