diff --git a/internal/filesystem/filesystem.go b/internal/filesystem/filesystem.go index c0b7e42..e47478e 100644 --- a/internal/filesystem/filesystem.go +++ b/internal/filesystem/filesystem.go @@ -2427,6 +2427,14 @@ func (fs *FileSystem) runTransform(currentRunDir string, currentRunConfigPaths [ logrus.Errorf("failed to start the transform command. Error: %q", err) return err } + go func() { + if err := cmd.Wait(); err != nil { + logrus.Errorf("failed to wait for end of the transform command. Error: %q", err) + } + logrus.Debug("Closing transform channel") + transformCh <- nil + close(transformCh) + }() wg := sync.WaitGroup{} outCh := make(chan string, 10) stdoutReader := bufio.NewReader(stdout) @@ -2461,13 +2469,7 @@ func (fs *FileSystem) runTransform(currentRunDir string, currentRunConfigPaths [ wg.Wait() close(outCh) }() - flag := true for outputLine := range outCh { - if flag && strings.Contains(outputLine, portStr) { - flag = false - transformCh <- nil - close(transformCh) - } if verbose { generateVerboseLogs(outputLine) } else {