This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ function test_elasticsearchcluster() {
128128 then
129129 fail_test " Elasticsearch pilot did not update the document count"
130130 fi
131+ kubectl cluster-info dump --namespaces " ${USER_NAMESPACE} " || true
131132 if ! kubectl delete \
132133 --namespace " ${USER_NAMESPACE} " \
133134 ElasticSearchClusters \
Original file line number Diff line number Diff line change @@ -14,8 +14,6 @@ func (p *Pilot) CmdFunc(pilot *v1alpha1.Pilot) (*exec.Cmd, error) {
1414 }
1515
1616 cmd := exec .Command ("elasticsearch" )
17- cmd .Stdout = os .Stdout
18- cmd .Stderr = os .Stderr
1917 cmd .Env = p .env ().Strings ()
2018
2119 return cmd , nil
Original file line number Diff line number Diff line change 11package process
22
33import (
4+ "bufio"
45 "fmt"
56 "os"
67 "os/exec"
8+ "sync"
79
810 "github.com/golang/glog"
911)
@@ -33,20 +35,64 @@ type Interface interface {
3335type Adapter struct {
3436 Signals Signals
3537 Cmd * exec.Cmd
38+ wg sync.WaitGroup
3639}
3740
3841var _ Interface = & Adapter {}
3942
43+ func (p * Adapter ) startCommandOutputLoggers () error {
44+ stdout , err := p .Cmd .StdoutPipe ()
45+ if err != nil {
46+ return err
47+ }
48+ p .wg .Add (1 )
49+ go func () {
50+ defer p .wg .Done ()
51+ in := bufio .NewScanner (stdout )
52+ for in .Scan () {
53+ glog .Infoln (in .Text ())
54+ }
55+ err := in .Err ()
56+ if err != nil {
57+ glog .Error (err )
58+ }
59+ }()
60+
61+ stderr , err := p .Cmd .StderrPipe ()
62+ if err != nil {
63+ return err
64+ }
65+ p .wg .Add (1 )
66+ go func () {
67+ defer p .wg .Done ()
68+ in := bufio .NewScanner (stderr )
69+ for in .Scan () {
70+ glog .Infoln (in .Text ())
71+ }
72+ err := in .Err ()
73+ if err != nil {
74+ glog .Error (err )
75+ }
76+ }()
77+ return nil
78+ }
79+
4080func (p * Adapter ) Start () error {
4181 glog .V (2 ).Infof ("Starting process: %v" , p .Cmd .Args )
4282
43- if err := p .Cmd .Start (); err != nil {
83+ err := p .startCommandOutputLoggers ()
84+ if err != nil {
85+ return err
86+ }
87+
88+ if err = p .Cmd .Start (); err != nil {
4489 return fmt .Errorf ("error starting process: %s" , err .Error ())
4590 }
4691 return nil
4792}
4893
4994func (p * Adapter ) Wait () error {
95+ defer p .wg .Wait ()
5096 return p .Cmd .Wait ()
5197}
5298
You can’t perform that action at this time.
0 commit comments