Browse Source

expect: reload DEBUG_EXPECT for each process

Lets e2e test cases selectively turn on expect debugging to get
full application output written to stdout.
Anthony Romano 8 years ago
parent
commit
71d7c85b6b
1 changed files with 1 additions and 2 deletions
  1. 1 2
      pkg/expect/expect.go

+ 1 - 2
pkg/expect/expect.go

@@ -44,8 +44,6 @@ type ExpectProcess struct {
 	StopSignal os.Signal
 	StopSignal os.Signal
 }
 }
 
 
-var printDebugLines = os.Getenv("EXPECT_DEBUG") != ""
-
 // NewExpect creates a new process for expect testing.
 // NewExpect creates a new process for expect testing.
 func NewExpect(name string, arg ...string) (ep *ExpectProcess, err error) {
 func NewExpect(name string, arg ...string) (ep *ExpectProcess, err error) {
 	// if env[] is nil, use current system env
 	// if env[] is nil, use current system env
@@ -75,6 +73,7 @@ func NewExpectWithEnv(name string, args []string, env []string) (ep *ExpectProce
 
 
 func (ep *ExpectProcess) read() {
 func (ep *ExpectProcess) read() {
 	defer ep.wg.Done()
 	defer ep.wg.Done()
+	printDebugLines := os.Getenv("EXPECT_DEBUG") != ""
 	r := bufio.NewReader(ep.fpty)
 	r := bufio.NewReader(ep.fpty)
 	for ep.err == nil {
 	for ep.err == nil {
 		ep.ptyMu.Lock()
 		ep.ptyMu.Lock()