@@ -736,8 +736,13 @@ int xcrunToolCommand(std::vector<std::string> commandAndArguments, XcrunToolBloc
736
736
dup2 (outPipe[1 ], STDOUT_FILENO);
737
737
dup2 (errPipe[1 ], STDERR_FILENO);
738
738
739
+ close (outPipe[0 ]);
740
+ close (errPipe[0 ]);
741
+
739
742
execv (launchPath, (char *const *)arguments.data ());
740
743
}
744
+ close (outPipe[1 ]);
745
+ close (errPipe[1 ]);
741
746
742
747
// Read stdout and stderr in parallel, then wait for the task
743
748
// to exit. Anything else risks deadlock if the task fills
@@ -754,9 +759,11 @@ int xcrunToolCommand(std::vector<std::string> commandAndArguments, XcrunToolBloc
754
759
});
755
760
756
761
auto const stdOutData = readToEOF (outPipe[0 ]);
762
+ close (outPipe[0 ]);
757
763
758
764
dispatch_semaphore_wait (gotStdErr, DISPATCH_TIME_FOREVER);
759
765
dispatch_release (gotStdErr);
766
+ close (errPipe[0 ]);
760
767
761
768
int status = 0 ;
762
769
waitpid (childPid, &status, 0 );
@@ -881,6 +888,7 @@ void enumerateDirectory(std::string directory, F&& func) {
881
888
return ;
882
889
}
883
890
891
+ std::vector<std::string> subpaths;
884
892
struct dirent *entry;
885
893
while ((entry = readdir (dir)) != NULL ) {
886
894
std::string path = directory + " /" + entry->d_name ;
@@ -891,9 +899,13 @@ void enumerateDirectory(std::string directory, F&& func) {
891
899
if (strncmp (entry->d_name , " .." , entry->d_namlen ) == 0 ) {
892
900
continue ;
893
901
}
894
- enumerateDirectory (path, func );
902
+ subpaths. push_back (path);
895
903
}
896
904
}
905
+ closedir (dir);
906
+ for (auto const &path : subpaths) {
907
+ enumerateDirectory (path, func);
908
+ }
897
909
}
898
910
899
911
0 commit comments