@@ -70,6 +70,7 @@ namespace vix::commands
7070 static std::string iso_utc_now_compact ()
7171 {
7272 using namespace std ::chrono;
73+
7374 const auto now = system_clock::now ();
7475 const std::time_t t = system_clock::to_time_t (now);
7576
@@ -80,11 +81,18 @@ namespace vix::commands
8081 gmtime_r (&t, &tm);
8182#endif
8283
83- char buf[32 ]{0 };
84- std::snprintf (buf, sizeof (buf), " %04d%02d%02dT%02d%02d%02dZ" ,
85- tm.tm_year + 1900 , tm.tm_mon + 1 , tm.tm_mday ,
86- tm.tm_hour , tm.tm_min , tm.tm_sec );
87- return std::string (buf);
84+ std::ostringstream oss;
85+
86+ oss << std::setw (4 ) << std::setfill (' 0' ) << (tm.tm_year + 1900 )
87+ << std::setw (2 ) << std::setfill (' 0' ) << (tm.tm_mon + 1 )
88+ << std::setw (2 ) << std::setfill (' 0' ) << tm.tm_mday
89+ << " T"
90+ << std::setw (2 ) << std::setfill (' 0' ) << tm.tm_hour
91+ << std::setw (2 ) << std::setfill (' 0' ) << tm.tm_min
92+ << std::setw (2 ) << std::setfill (' 0' ) << tm.tm_sec
93+ << " Z" ;
94+
95+ return oss.str ();
8896 }
8997
9098 static std::string home_dir ()
@@ -123,17 +131,20 @@ namespace vix::commands
123131 return fs::exists (dir / " .git" , ec);
124132 }
125133
126- std::string join_for_log (const std::vector<std::string> &args)
134+ #if defined(_WIN32)
135+ static std::string join_for_log (
136+ const std::vector<std::string> &args)
127137 {
128138 std::ostringstream out;
129139
130140 for (std::size_t i = 0 ; i < args.size (); ++i)
131141 {
132142 if (i > 0 )
143+ {
133144 out << ' ' ;
145+ }
134146
135147 const std::string &arg = args[i];
136-
137148 const bool needsQuotes =
138149 arg.find (' ' ) != std::string::npos ||
139150 arg.find (' \t ' ) != std::string::npos ||
@@ -149,15 +160,20 @@ namespace vix::commands
149160 for (char c : arg)
150161 {
151162 if (c == ' "' )
163+ {
152164 out << " \\\" " ;
165+ }
153166 else
167+ {
154168 out << c;
169+ }
155170 }
156171 out << ' "' ;
157172 }
158173
159174 return out.str ();
160175 }
176+ #endif
161177
162178 /* =========================
163179 Process runner (no system)
@@ -403,7 +419,12 @@ namespace vix::commands
403419 if (pid == 0 )
404420 {
405421 if (cwd)
406- (void )chdir (cwd->c_str ());
422+ {
423+ if (chdir (cwd->c_str ()) != 0 )
424+ {
425+ _exit (127 );
426+ }
427+ }
407428
408429 dup2 (outPipe[1 ], STDOUT_FILENO);
409430 dup2 (errPipe[1 ], STDERR_FILENO);
0 commit comments