File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -435,10 +435,12 @@ namespace vix::commands
435435 if (pid == 0 )
436436 {
437437 // child
438- if (chdir ( cwd-> c_str ()) != 0 )
438+ if (cwd)
439439 {
440- _exit (127 );
440+ if (chdir (cwd->c_str ()) != 0 )
441+ _exit (127 );
441442 }
443+
442444 dup2 (outPipe[1 ], STDOUT_FILENO);
443445 dup2 (errPipe[1 ], STDERR_FILENO);
444446
@@ -456,7 +458,6 @@ namespace vix::commands
456458 execvp (argv[0 ], argv.data ());
457459 _exit (127 );
458460 }
459-
460461 // parent
461462 close (outPipe[1 ]);
462463 close (errPipe[1 ]);
@@ -725,8 +726,11 @@ namespace vix::commands
725726
726727 static bool is_git_repo (const fs::path &dir)
727728 {
728- std::error_code ec;
729- return fs::exists (dir / " .git" , ec);
729+ const auto r = run_process_capture (
730+ {" git" , " rev-parse" , " --is-inside-work-tree" },
731+ dir);
732+
733+ return r.exitCode == 0 && trim_copy (r.out ) == " true" ;
730734 }
731735
732736 static bool command_exists_on_path (const std::string &exe)
You can’t perform that action at this time.
0 commit comments