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

Fix opening a command line window on mac #190

Merged
merged 1 commit into from
Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/GitHub.Api/OutputProcessors/IProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ T Configure<T>(T processTask, string executableFileName, string arguments, NPath
where T : IProcess;
IProcess Reconnect(IProcess processTask, int i);
CancellationToken CancellationToken { get; }
IProcess RunCommandLineWindow(NPath workingDirectory);
void RunCommandLineWindow(NPath workingDirectory);
}
}
24 changes: 17 additions & 7 deletions src/GitHub.Api/OutputProcessors/ProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ public T Configure<T>(T processTask, string executableFileName, string arguments
return processTask;
}

public IProcess RunCommandLineWindow(NPath workingDirectory)
public void RunCommandLineWindow(NPath workingDirectory)
{
var shell = environment.IsWindows ? "cmd" : environment.IsMac ? "xterm" : "sh";
var startInfo = new ProcessStartInfo(shell)
var startInfo = new ProcessStartInfo
{
RedirectStandardInput = false,
RedirectStandardOutput = false,
Expand All @@ -69,11 +68,22 @@ public IProcess RunCommandLineWindow(NPath workingDirectory)
CreateNoWindow = false
};

if (environment.IsWindows)
{
startInfo.FileName = "cmd";
}
else if (environment.IsMac)
{
startInfo.FileName = "open";
startInfo.Arguments = $"-a Terminal {workingDirectory}";
}
else
{
startInfo.FileName = "sh";
}

gitEnvironment.Configure(startInfo, workingDirectory);
var p = new ProcessTask<string>(cancellationToken, new SimpleOutputProcessor());
p.Configure(startInfo);
p.Start();
return p;
Process.Start(startInfo);
}

public IProcess Reconnect(IProcess processTask, int pid)
Expand Down