diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-07-11 17:56:03 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-07-11 17:25:51 +0000 |
| commit | eaeb5c15ad704753a93bc8f8c7fc422d2a189581 (patch) | |
| tree | 9553b463a5c3dd4a06164f9524cd525948917ecd /vm | |
| parent | b04e57fd40197ad82e1b77e1db4c63f3f7d413cf (diff) | |
vm/vmimpl: don't wait commands that have not failed
The sleep in Multiplex is unconditional and it sleeps idle
even for commands that has nothting to do with executor,
and for executor in other modes that has nothing to do with fuzzing.
Since the original reason for the sleep was related to failing executor,
sleep only when the command fails. This allows to at least run
successful commands fast.
Diffstat (limited to 'vm')
| -rw-r--r-- | vm/vmimpl/vmimpl.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go index fa2719f5f..ce2a0dfb6 100644 --- a/vm/vmimpl/vmimpl.go +++ b/vm/vmimpl/vmimpl.go @@ -191,14 +191,6 @@ func Multiplex(cmd *exec.Cmd, merger *OutputMerger, timeout time.Duration, confi signal(fmt.Errorf("instance closed")) case err := <-merger.Err: cmd.Process.Kill() - // Once the command has exited, we might want to let the full console - // output accumulate before we abort the console connection too. - time.Sleep(WaitForOutputTimeout * config.Scale) - if config.Console != nil { - // Only wait for the merger if we're able to control the console stream. - config.Console.Close() - merger.Wait() - } if cmdErr := cmd.Wait(); cmdErr == nil { // If the command exited successfully, we got EOF error from merger. // But in this case no error has happened and the EOF is expected. @@ -206,6 +198,16 @@ func Multiplex(cmd *exec.Cmd, merger *OutputMerger, timeout time.Duration, confi } else if config.IgnoreError != nil && config.IgnoreError(err) { err = ErrTimeout } + // Once the command has failed, we might want to let the full console + // output accumulate before we abort the console connection too. + if err != nil { + time.Sleep(WaitForOutputTimeout * config.Scale) + } + if config.Console != nil { + // Only wait for the merger if we're able to control the console stream. + config.Console.Close() + merger.Wait() + } signal(err) return } |
