Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 53d8a37

Browse files
Merge pull request #302 from github-for-unity/fixes/mac-stranger-things
Fix to correctly configure FindExecTask
2 parents d925d43 + 16b6499 commit 53d8a37

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

src/GitHub.Api/Git/GitClient.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,30 @@ public async Task<NPath> FindGitInstallation()
103103
if (!String.IsNullOrEmpty(environment.GitExecutablePath))
104104
return environment.GitExecutablePath;
105105

106-
var path = await LookForPortableGit();
106+
NPath path = null;
107+
108+
if (environment.IsWindows)
109+
path = await LookForPortableGit();
110+
107111
if (path == null)
108112
path = await LookForSystemGit();
109113

110-
Logger.Trace("Git Installation folder {0} discovered: '{1}'", path == null ? "not" : "", path);
114+
if (path == null)
115+
{
116+
Logger.Trace("Git Installation not discovered");
117+
}
118+
else
119+
{
120+
Logger.Trace("Git Installation discovered: '{0}'", path);
121+
}
111122

112123
return path;
113124
}
114125

115126
private Task<NPath> LookForPortableGit()
116127
{
128+
Logger.Trace("LookForPortableGit");
129+
117130
var gitHubLocalAppDataPath = environment.UserCachePath;
118131
if (!gitHubLocalAppDataPath.DirectoryExists())
119132
return null;
@@ -134,16 +147,22 @@ private Task<NPath> LookForPortableGit()
134147

135148
private async Task<NPath> LookForSystemGit()
136149
{
150+
Logger.Trace("LookForSystemGit");
151+
137152
NPath path = null;
138153
if (!environment.IsWindows)
139154
{
140155
var p = new NPath("/usr/local/bin/git");
156+
141157
if (p.FileExists())
142158
path = p;
143159
}
144160

145161
if (path == null)
146-
path = await new FindExecTask("git", taskManager.Token).StartAwait();
162+
{
163+
path = await new FindExecTask("git", taskManager.Token)
164+
.Configure(processManager).StartAwait();
165+
}
147166

148167
return path;
149168
}

src/GitHub.Api/OutputProcessors/ProcessManager.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,28 @@ public ProcessManager(IEnvironment environment, IProcessEnvironment gitEnvironme
2424

2525
public T Configure<T>(T processTask, bool withInput = false) where T : IProcess
2626
{
27+
NPath executableFileName;
28+
if (processTask.ProcessName != null)
29+
{
30+
executableFileName = processTask.ProcessName.ToNPath();
31+
//logger.Trace("Configuring Task:{0} with Exec:{1}", processTask.GetType().Name, executableFileName);
32+
}
33+
else
34+
{
35+
executableFileName = environment.GitExecutablePath;
36+
//logger.Trace("Configuring Task:{0} with Git", processTask.GetType().Name);
37+
}
38+
2739
return Configure(processTask,
28-
processTask.ProcessName?.ToNPath() ?? environment.GitExecutablePath,
40+
executableFileName,
2941
processTask.ProcessArguments,
3042
environment.RepositoryPath, withInput);
3143
}
3244

3345
public T Configure<T>(T processTask, string executableFileName, string arguments, NPath workingDirectory = null, bool withInput = false)
3446
where T : IProcess
3547
{
48+
//If this null check fails, be sure you called Configure() on your task
3649
Guard.ArgumentNotNull(executableFileName, nameof(executableFileName));
3750

3851
var startInfo = new ProcessStartInfo

src/GitHub.Api/Platform/FindExecTask.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public FindExecTask(string executable, CancellationToken token)
1313
arguments = executable;
1414
}
1515

16+
public override string ProcessName { get { return Name; } }
1617
public override string ProcessArguments { get { return arguments; } }
1718
public override TaskAffinity Affinity { get { return TaskAffinity.Concurrent; } }
1819
}

0 commit comments

Comments
 (0)