By default, the timeout plugin resets its timer whenever data is received on stdOut or stdErr. When using the progress plugin, git streams regular updates to stdErr, which can prevent the timeout from ever triggering.
To prevent progress updates from resetting the timeout timer, set stdErr: false in the timeout configuration. You can also explicitly set stdOut: true (the default behavior) to reset the timer whenever data arrives on stdOut.
import { simpleGit, SimpleGit } from "simple-git";
const git: SimpleGit = simpleGit({
progress({method, stage, progress}) {
console.log(`git.${method} ${stage} stage ${progress}% complete`);
},
timeout: {
block: 2000,
stdOut: true, // default behaviour, resets the 2s timer every time data arrives on stdOut
stdErr: false // custom behaviour, ignore the progress events being written to stdErr
}
});