try to fix test 'cmdext:TestFailOnStderr'
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 39s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 39s
This commit is contained in:
parent
a2ba283632
commit
c63cf442f8
6
Makefile
6
Makefile
@ -7,5 +7,11 @@ test:
|
||||
which gotestsum || go install gotest.tools/gotestsum@latest
|
||||
gotestsum --format "testname" -- -tags="timetzdata sqlite_fts5 sqlite_foreign_keys" "./..."
|
||||
|
||||
test-in-docker:
|
||||
tag="goext_temp_test_image:$(shell uuidgen | tr -d '-')"; \
|
||||
docker build --tag $$tag . -f .gitea/workflows/Dockerfile_tests; \
|
||||
docker run --rm $$tag; \
|
||||
docker rmi $$tag
|
||||
|
||||
version:
|
||||
_data/version.sh
|
@ -133,9 +133,6 @@ func run(opt CommandRunner) (CommandResult, error) {
|
||||
|
||||
case <-stderrFailChan:
|
||||
_ = cmd.Process.Kill()
|
||||
for _, lstr := range opt.listener {
|
||||
lstr.Timeout()
|
||||
}
|
||||
|
||||
if fallback, ok := syncext.ReadChannelWithTimeout(outputChan, 32*time.Millisecond); ok {
|
||||
// most of the time the cmd.Process.Kill() should also have finished the pipereader
|
||||
@ -160,7 +157,8 @@ func run(opt CommandRunner) (CommandResult, error) {
|
||||
}
|
||||
|
||||
case outobj := <-outputChan:
|
||||
if exiterr, ok := outobj.err.(*exec.ExitError); ok {
|
||||
var exiterr *exec.ExitError
|
||||
if errors.As(outobj.err, &exiterr) {
|
||||
excode := exiterr.ExitCode()
|
||||
for _, lstr := range opt.listener {
|
||||
lstr.Finished(excode)
|
||||
|
@ -32,8 +32,8 @@ func (pr *pipeReader) Read(listener []CommandListener) (string, string, string,
|
||||
stdout := ""
|
||||
go func() {
|
||||
buf := make([]byte, 128)
|
||||
for true {
|
||||
n, out := pr.stdout.Read(buf)
|
||||
for {
|
||||
n, err := pr.stdout.Read(buf)
|
||||
if n > 0 {
|
||||
txt := string(buf[:n])
|
||||
stdout += txt
|
||||
@ -42,11 +42,11 @@ func (pr *pipeReader) Read(listener []CommandListener) (string, string, string,
|
||||
lstr.ReadRawStdout(buf[:n])
|
||||
}
|
||||
}
|
||||
if out == io.EOF {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if out != nil {
|
||||
errch <- out
|
||||
if err != nil {
|
||||
errch <- err
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ func (pr *pipeReader) Read(listener []CommandListener) (string, string, string,
|
||||
stderr := ""
|
||||
go func() {
|
||||
buf := make([]byte, 128)
|
||||
for true {
|
||||
for {
|
||||
n, err := pr.stderr.Read(buf)
|
||||
|
||||
if n > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user