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

Commit f1dcc58

Browse files
Merge pull request #190 from github-for-unity/fixes/command-line-osx
Fix opening a command line window on mac
2 parents 39f8224 + 6f15471 commit f1dcc58

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/GitHub.Api/OutputProcessors/IProcessManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ T Configure<T>(T processTask, string executableFileName, string arguments, NPath
99
where T : IProcess;
1010
IProcess Reconnect(IProcess processTask, int i);
1111
CancellationToken CancellationToken { get; }
12-
IProcess RunCommandLineWindow(NPath workingDirectory);
12+
void RunCommandLineWindow(NPath workingDirectory);
1313
}
1414
}

src/GitHub.Api/OutputProcessors/ProcessManager.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ public T Configure<T>(T processTask, string executableFileName, string arguments
5757
return processTask;
5858
}
5959

60-
public IProcess RunCommandLineWindow(NPath workingDirectory)
60+
public void RunCommandLineWindow(NPath workingDirectory)
6161
{
62-
var shell = environment.IsWindows ? "cmd" : environment.IsMac ? "xterm" : "sh";
63-
var startInfo = new ProcessStartInfo(shell)
62+
var startInfo = new ProcessStartInfo
6463
{
6564
RedirectStandardInput = false,
6665
RedirectStandardOutput = false,
@@ -69,11 +68,22 @@ public IProcess RunCommandLineWindow(NPath workingDirectory)
6968
CreateNoWindow = false
7069
};
7170

71+
if (environment.IsWindows)
72+
{
73+
startInfo.FileName = "cmd";
74+
}
75+
else if (environment.IsMac)
76+
{
77+
startInfo.FileName = "open";
78+
startInfo.Arguments = $"-a Terminal {workingDirectory}";
79+
}
80+
else
81+
{
82+
startInfo.FileName = "sh";
83+
}
84+
7285
gitEnvironment.Configure(startInfo, workingDirectory);
73-
var p = new ProcessTask<string>(cancellationToken, new SimpleOutputProcessor());
74-
p.Configure(startInfo);
75-
p.Start();
76-
return p;
86+
Process.Start(startInfo);
7787
}
7888

7989
public IProcess Reconnect(IProcess processTask, int pid)

0 commit comments

Comments
 (0)