Skip to content

Commit 0de30f4

Browse files
committed
Test if the line in contrib/postgres/test.sql is the culprit
1 parent e0e0807 commit 0de30f4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

contrib/postgres/test.sql

-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ insert into authors (name) values
6666

6767
\echo `echo hello`
6868

69-
select :"COLNAME" from authors where :COLNAME like '%' || :'NAME' || '%'
70-
7169
\print \raw
7270

7371
\g

testcli.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"log"
1313
"os"
1414
"regexp"
15+
"strings"
1516
"time"
1617

1718
gexpect "github.com/google/goexpect"
@@ -119,6 +120,7 @@ func (test Test) do(ctx context.Context, binpath string, timeout time.Duration)
119120
gexpect.SetEnv(test.env),
120121
gexpect.Tee(&noopWriteCloser{os.Stdout}),
121122
)
123+
exp.Options(gexpect.Verbose(true))
122124
if err != nil {
123125
return err
124126
}
@@ -127,8 +129,12 @@ func (test Test) do(ctx context.Context, binpath string, timeout time.Duration)
127129
return err
128130
}
129131
for _, line := range bytes.Split(buf, []byte{'\n'}) {
130-
if err := exp.Send(string(line) + "\n"); err != nil {
131-
return err
132+
lineStr := strings.TrimSpace(string(line))
133+
if lineStr != "" { // technically only trailing empty lines are a problem but they are harder to check for
134+
time.Sleep(100 * time.Millisecond)
135+
if err := exp.Send(string(line) + "\n"); err != nil {
136+
return err
137+
}
132138
}
133139
}
134140
select {

0 commit comments

Comments
 (0)