File tree Expand file tree Collapse file tree 4 files changed +28
-4
lines changed
include/vix/cli/commands/run Expand file tree Collapse file tree 4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,12 @@ namespace vix::commands::RunCommand::detail
7676 std::string badDoubleDashArg;
7777 };
7878
79+ struct ScriptRunResult
80+ {
81+ int code = 0 ;
82+ bool handled = false ;
83+ };
84+
7985 // Process / IO
8086 int run_cmd_live_filtered (
8187 const std::string &cmd,
@@ -91,6 +97,9 @@ namespace vix::commands::RunCommand::detail
9197 if (code < 0 )
9298 return 1 ;
9399
100+ if (code <= 255 )
101+ return code;
102+
94103 if (WIFEXITED (code))
95104 return WEXITSTATUS (code);
96105
Original file line number Diff line number Diff line change @@ -301,7 +301,12 @@ namespace vix::commands::RunCommand
301301
302302 if (opt.singleCpp )
303303 {
304- return detail::run_single_cpp (opt);
304+ int rc = detail::run_single_cpp (opt);
305+
306+ if (rc < 0 )
307+ return -rc;
308+
309+ return rc;
305310 }
306311
307312 // 2) Mode projet (apps)
Original file line number Diff line number Diff line change @@ -559,7 +559,9 @@ namespace vix::commands::RunCommand::detail
559559
560560 if (::pipe (outPipe) != 0 )
561561 {
562- result.exitCode = std::system (cmd.c_str ());
562+ const int st = std::system (cmd.c_str ());
563+ result.rawStatus = st;
564+ result.exitCode = normalize_exit_code (st);
563565 return result;
564566 }
565567
@@ -569,7 +571,9 @@ namespace vix::commands::RunCommand::detail
569571 close_safe (outPipe[0 ]);
570572 close_safe (outPipe[1 ]);
571573
572- result.exitCode = std::system (cmd.c_str ());
574+ const int st = std::system (cmd.c_str ());
575+ result.rawStatus = st;
576+ result.exitCode = normalize_exit_code (st);
573577 return result;
574578 }
575579
Original file line number Diff line number Diff line change @@ -507,7 +507,13 @@ namespace vix::commands::RunCommand::detail
507507 }
508508 }
509509
510- handle_runtime_exit_code (runCode, " Script execution failed" , /* alreadyHandled=*/ handled);
510+ const bool already = handled || rr.printed_live ;
511+
512+ handle_runtime_exit_code (runCode, " Script execution failed" , /* alreadyHandled=*/ already);
513+
514+ if (already && runCode > 0 && runCode != 130 )
515+ return -runCode;
516+
511517 return runCode;
512518 }
513519
You can’t perform that action at this time.
0 commit comments