Skip to content

Commit ce5031e

Browse files
committed
cli(run): centralize runtime timeout logic for server-like processes
1 parent e4f7c26 commit ce5031e

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

include/vix/cli/commands/run/RunDetail.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,14 @@ namespace vix::commands::RunCommand::detail
181181
const std::filesystem::path &projectDir,
182182
const std::string &configurePreset);
183183

184+
inline int effective_timeout_sec(const Options &opt)
185+
{
186+
if (opt.forceServerLike || opt.watch)
187+
return 0;
188+
189+
return opt.timeoutSec;
190+
}
191+
184192
} // namespace vix::commands::RunCommand::detail
185193

186194
#endif

src/commands/RunCommand.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ namespace vix::commands::RunCommand
543543
const LiveRunResult tr = run_cmd_live_filtered_capture(
544544
quote(testExe->string()),
545545
/*spinnerLabel=*/"",
546-
/*passthroughRuntime=*/false,
547-
/*timeoutSec=*/opt.timeoutSec);
546+
/*passthroughRuntime=*/true,
547+
/*timeoutSec=*/effective_timeout_sec(opt));
548548

549549
const int testExit = tr.exitCode;
550550

@@ -620,11 +620,15 @@ namespace vix::commands::RunCommand
620620
#else
621621
std::string runCmd = quote(exePath.string());
622622

623+
int timeout = opt.timeoutSec;
624+
if (opt.forceServerLike || opt.watch)
625+
timeout = 0;
626+
623627
const LiveRunResult rr = run_cmd_live_filtered_capture(
624628
runCmd,
625629
/*spinnerLabel=*/"",
626-
/*passthroughRuntime=*/false, // IMPORTANT: capture only
627-
/*timeoutSec=*/opt.timeoutSec);
630+
/*passthroughRuntime=*/true,
631+
/*timeoutSec=*/effective_timeout_sec(opt));
628632

629633
int runExit = rr.exitCode;
630634

0 commit comments

Comments
 (0)