Skip to content

Commit dfd3dad

Browse files
committed
trace2: pass to terminal classes
Pass instance of Trace2 to terminal classes in preparation for capturing exceptions, which will be added in a future commit.
1 parent 31af9ab commit dfd3dad

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

src/shared/Core/CommandContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public CommandContext()
105105
Environment = new WindowsEnvironment(FileSystem);
106106
SessionManager = new WindowsSessionManager(Environment, FileSystem);
107107
ProcessManager = new WindowsProcessManager(Trace2);
108-
Terminal = new WindowsTerminal(Trace);
108+
Terminal = new WindowsTerminal(Trace, Trace2);
109109
string gitPath = GetGitPath(Environment, FileSystem, Trace);
110110
Git = new GitProcess(
111111
Trace,
@@ -122,7 +122,7 @@ public CommandContext()
122122
SessionManager = new MacOSSessionManager(Environment, FileSystem);
123123
Environment = new MacOSEnvironment(FileSystem);
124124
ProcessManager = new ProcessManager(Trace2);
125-
Terminal = new MacOSTerminal(Trace);
125+
Terminal = new MacOSTerminal(Trace, Trace2);
126126
string gitPath = GetGitPath(Environment, FileSystem, Trace);
127127
Git = new GitProcess(
128128
Trace,
@@ -139,7 +139,7 @@ public CommandContext()
139139
SessionManager = new LinuxSessionManager(Environment, FileSystem);
140140
Environment = new PosixEnvironment(FileSystem);
141141
ProcessManager = new ProcessManager(Trace2);
142-
Terminal = new LinuxTerminal(Trace);
142+
Terminal = new LinuxTerminal(Trace, Trace2);
143143
string gitPath = GetGitPath(Environment, FileSystem, Trace);
144144
Git = new GitProcess(
145145
Trace,

src/shared/Core/Interop/Linux/LinuxTerminal.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ namespace GitCredentialManager.Interop.Linux
77
{
88
public class LinuxTerminal : PosixTerminal
99
{
10-
public LinuxTerminal(ITrace trace)
11-
: base(trace) { }
10+
public LinuxTerminal(ITrace trace, ITrace2 trace2)
11+
: base(trace, trace2) { }
1212

1313
protected override IDisposable CreateTtyContext(int fd, bool echo)
1414
{
15-
return new TtyContext(Trace, fd, echo);
15+
return new TtyContext(Trace, Trace2, fd, echo);
1616
}
1717

1818
private class TtyContext : IDisposable
@@ -23,7 +23,7 @@ private class TtyContext : IDisposable
2323
private termios_Linux _originalTerm;
2424
private bool _isDisposed;
2525

26-
public TtyContext(ITrace trace, int fd, bool echo)
26+
public TtyContext(ITrace trace, ITrace2 trace2, int fd, bool echo)
2727
{
2828
EnsureArgument.NotNull(trace, nameof(trace));
2929
EnsureArgument.PositiveOrZero(fd, nameof(fd));

src/shared/Core/Interop/MacOS/MacOSTerminal.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ namespace GitCredentialManager.Interop.MacOS
77
{
88
public class MacOSTerminal : PosixTerminal
99
{
10-
public MacOSTerminal(ITrace trace)
11-
: base(trace) { }
10+
public MacOSTerminal(ITrace trace, ITrace2 trace2)
11+
: base(trace, trace2) { }
1212

1313
protected override IDisposable CreateTtyContext(int fd, bool echo)
1414
{
15-
return new TtyContext(Trace, fd, echo);
15+
return new TtyContext(Trace, Trace2, fd, echo);
1616
}
1717

1818
private class TtyContext : IDisposable
@@ -23,7 +23,7 @@ private class TtyContext : IDisposable
2323
private termios_MacOS _originalTerm;
2424
private bool _isDisposed;
2525

26-
public TtyContext(ITrace trace, int fd, bool echo)
26+
public TtyContext(ITrace trace, ITrace2 trace2, int fd, bool echo)
2727
{
2828
EnsureArgument.NotNull(trace, nameof(trace));
2929
EnsureArgument.PositiveOrZero(fd, nameof(fd));

src/shared/Core/Interop/Posix/PosixTerminal.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public abstract class PosixTerminal : ITerminal
1313
private const byte DeleteChar = 127;
1414

1515
protected readonly ITrace Trace;
16+
protected readonly ITrace2 Trace2;
1617

17-
public PosixTerminal(ITrace trace)
18+
public PosixTerminal(ITrace trace, ITrace2 trace2)
1819
{
1920
PlatformUtils.EnsurePosix();
2021
EnsureArgument.NotNull(trace, nameof(trace));

src/shared/Core/Interop/Windows/WindowsTerminal.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ public class WindowsTerminal : ITerminal
1717
private const string ConsoleOutName = "CONOUT$";
1818

1919
private readonly ITrace _trace;
20+
private readonly ITrace2 _trace2;
2021

21-
public WindowsTerminal(ITrace trace)
22+
public WindowsTerminal(ITrace trace, ITrace2 trace2)
2223
{
2324
PlatformUtils.EnsureWindows();
2425

2526
_trace = trace;
27+
_trace2 = trace2;
2628
}
2729

2830
public void WriteLine(string format, params object[] args)

0 commit comments

Comments
 (0)