Fix race in RunCommandWithOutputForDuration Upstream-commit: 7c1c96551d41e369a588e365a9bb99acb5bc8fdb Component: engine