@@ -48,7 +48,7 @@ export type QaScenarioCommandExecution = {
|
48 | 48 | command: string; |
49 | 49 | cwd: string; |
50 | 50 | env: NodeJS.ProcessEnv; |
51 | | -timeoutMs: number; |
| 51 | +timeoutMs?: number; |
52 | 52 | }; |
53 | 53 | |
54 | 54 | type QaScenarioCommandResult = { |
@@ -199,6 +199,7 @@ function runQaScenarioCommand(
|
199 | 199 | }); |
200 | 200 | const stdout: Buffer[] = []; |
201 | 201 | const stderr: Buffer[] = []; |
| 202 | +const timeoutMs = execution.timeoutMs; |
202 | 203 | let forceKillTimer: NodeJS.Timeout | undefined; |
203 | 204 | let forceSettleTimer: NodeJS.Timeout | undefined; |
204 | 205 | let settled = false; |
@@ -307,16 +308,19 @@ function runQaScenarioCommand(
|
307 | 308 | }, QA_TEST_FILE_COMMAND_TIMEOUT_FORCE_SETTLE_MS); |
308 | 309 | }, QA_TEST_FILE_COMMAND_TIMEOUT_KILL_GRACE_MS); |
309 | 310 | }; |
310 | | -timeoutTimer = setTimeout(() => { |
311 | | -timeoutTimer = undefined; |
312 | | -timedOut = true; |
313 | | -signalChild("SIGTERM"); |
314 | | -scheduleForcedCleanup({ |
315 | | -exitCode: 1, |
316 | | -failureMessage: `${commandLabel()} timed out after ${execution.timeoutMs}ms`, |
317 | | -signal: null, |
318 | | -}); |
319 | | -}, execution.timeoutMs); |
| 311 | +timeoutTimer = |
| 312 | +timeoutMs === undefined |
| 313 | + ? undefined |
| 314 | + : setTimeout(() => { |
| 315 | +timeoutTimer = undefined; |
| 316 | +timedOut = true; |
| 317 | +signalChild("SIGTERM"); |
| 318 | +scheduleForcedCleanup({ |
| 319 | +exitCode: 1, |
| 320 | +failureMessage: `${commandLabel()} timed out after ${timeoutMs}ms`, |
| 321 | +signal: null, |
| 322 | +}); |
| 323 | +}, timeoutMs); |
320 | 324 | child.stdout?.on("data", (chunk: Buffer) => { |
321 | 325 | stdout.push(chunk); |
322 | 326 | }); |
@@ -340,9 +344,7 @@ function runQaScenarioCommand(
|
340 | 344 | const result = { |
341 | 345 | exitCode: timedOut ? 1 : (exitCode ?? (signal ? 1 : 0)), |
342 | 346 | signal, |
343 | | - ...(timedOut |
344 | | - ? { failureMessage: `${commandLabel()} timed out after ${execution.timeoutMs}ms` } |
345 | | - : {}), |
| 347 | + ...(timedOut ? { failureMessage: `${commandLabel()} timed out after ${timeoutMs}ms` } : {}), |
346 | 348 | }; |
347 | 349 | if (isProcessGroupRunning()) { |
348 | 350 | if (!timedOut) { |
@@ -384,12 +386,14 @@ async function runScenarioCommandSteps(params: {
|
384 | 386 | for (const step of params.steps) { |
385 | 387 | logChunks.push(`$ ${formatCommand(step)}\n`); |
386 | 388 | try { |
| 389 | +const timeoutMs = |
| 390 | +params.scenario.execution.kind === "script" ? params.commandTimeoutMs : undefined; |
387 | 391 | const result = await params.runCommand({ |
388 | 392 | command: step.command, |
389 | 393 | args: step.args, |
390 | 394 | cwd: params.repoRoot, |
391 | 395 | env: params.env, |
392 | | -timeoutMs: params.commandTimeoutMs, |
| 396 | +...(timeoutMs === undefined ? {} : { timeoutMs }), |
393 | 397 | }); |
394 | 398 | if (result.stdout) { |
395 | 399 | logChunks.push(result.stdout); |
|