@@ -946,7 +946,7 @@ namespace vix::commands::RunCommand::detail
946946 ::kill (pid, sig);
947947 }
948948
949- void child_exec_shell (const std::string &cmd, int masterFd, int slaveFd)
949+ void child_exec_shell (const std::string &cmd, int masterFd, int slaveFd, bool useSan )
950950 {
951951 struct sigaction saChild{};
952952 saChild.sa_handler = SIG_DFL;
@@ -956,20 +956,24 @@ namespace vix::commands::RunCommand::detail
956956
957957 ::setsid ();
958958
959- ::setenv (" ASAN_OPTIONS" ,
960- " abort_on_error=1:"
961- " detect_leaks=1:"
962- " symbolize=1:"
963- " allocator_may_return_null=1:"
964- " fast_unwind_on_malloc=0:"
965- " strict_init_order=1:"
966- " check_initialization_order=1:"
967- " color=never" ,
968- 1 );
969-
970- ::setenv (" UBSAN_OPTIONS" ,
971- " halt_on_error=1:print_stacktrace=1:color=never" ,
972- 1 );
959+ if (useSan)
960+ {
961+ ::setenv (" ASAN_OPTIONS" ,
962+ " abort_on_error=1:"
963+ " halt_on_error=1:"
964+ " print_stacktrace=1:"
965+ " detect_leaks=1:"
966+ " symbolize=1:"
967+ " fast_unwind_on_malloc=0:"
968+ " strict_init_order=1:"
969+ " check_initialization_order=1:"
970+ " color=never" ,
971+ 1 );
972+
973+ ::setenv (" UBSAN_OPTIONS" ,
974+ " halt_on_error=1:print_stacktrace=1:color=never" ,
975+ 1 );
976+ }
973977
974978 ::close (masterFd);
975979
@@ -1057,7 +1061,8 @@ namespace vix::commands::RunCommand::detail
10571061 const std::string &cmd,
10581062 const std::string &spinnerLabel,
10591063 bool passthroughRuntime,
1060- int timeoutSec)
1064+ int timeoutSec,
1065+ bool useSan)
10611066 {
10621067 SigintGuard sigGuard;
10631068 LiveRunResult result;
@@ -1081,7 +1086,7 @@ namespace vix::commands::RunCommand::detail
10811086 }
10821087
10831088 if (pid == 0 )
1084- child_exec_shell (cmd, pty.masterFd , pty.slaveFd );
1089+ child_exec_shell (cmd, pty.masterFd , pty.slaveFd , useSan );
10851090
10861091 close_safe (pty.slaveFd );
10871092 ::setpgid (pid, pid);
@@ -1339,7 +1344,8 @@ namespace vix::commands::RunCommand::detail
13391344 cmd,
13401345 spinnerLabel,
13411346 false ,
1342- 0 );
1347+ 0 ,
1348+ false );
13431349 return r.exitCode ;
13441350#endif
13451351 }
0 commit comments