Skip to content

Commit 4e4f7eb

Browse files
committed
Version 1.1
Code to attach to the PowerShell host is now called by the Add-LogFile and Add-OutputSubscriber cmdlets, instead of by the psm1 file at module load time. This is to address an issue where the module auto-loading due to tab completion was somehow causing it not to attach to the host properly.
1 parent 3d39924 commit 4e4f7eb

15 files changed

+113
-99
lines changed

Commands/AddLogFileCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ protected override void EndProcessing()
6969
logFile = this.inputObject;
7070
}
7171

72-
HostIoInterceptor.GetInterceptor().AddSubscriber(logFile);
72+
HostIOInterceptor.Instance.AttachToHost(this.Host);
73+
HostIOInterceptor.Instance.AddSubscriber(logFile);
7374
}
7475
} // End AddLogFileCommand class
7576
}

Commands/AddOutputSubscriberCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ protected override void EndProcessing()
8383
subscriber = this.inputObject;
8484
}
8585

86-
HostIoInterceptor.GetInterceptor().AddSubscriber(subscriber);
86+
HostIOInterceptor.Instance.AttachToHost(this.Host);
87+
HostIOInterceptor.Instance.AddSubscriber(subscriber);
8788
}
8889
} // End AddOutputSubscriberCommand class
8990
}

Commands/DisableLogFileCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DisableLogFileCommand : PSCmdlet
1616

1717
protected override void EndProcessing()
1818
{
19-
HostIoInterceptor.GetInterceptor().RemoveSubscriber(this.InputObject);
19+
HostIOInterceptor.Instance.RemoveSubscriber(this.InputObject);
2020
}
2121
} // End DisableLogFileCommand class
2222
}

Commands/DisableOutputSubscriberCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DisableOutputSubscriberCommand : PSCmdlet
1616

1717
protected override void EndProcessing()
1818
{
19-
HostIoInterceptor.GetInterceptor().RemoveSubscriber(this.InputObject);
19+
HostIOInterceptor.Instance.RemoveSubscriber(this.InputObject);
2020
}
2121
} // End DisableOutputSubscriberCommand class
2222
}

Commands/GetLogFileCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public string Path
2727

2828
protected override void EndProcessing()
2929
{
30-
foreach (IHostIoSubscriber subscriber in HostIoInterceptor.GetInterceptor().Subscribers)
30+
foreach (IHostIOSubscriber subscriber in HostIOInterceptor.Instance.Subscribers)
3131
{
3232
var logFile = subscriber as LogFile;
3333

Commands/GetOutputSubscriberCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class GetOutputSubscriberCommand : PSCmdlet
1212
{
1313
protected override void EndProcessing()
1414
{
15-
foreach (IHostIoSubscriber subscriber in HostIoInterceptor.GetInterceptor().Subscribers)
15+
foreach (IHostIOSubscriber subscriber in HostIOInterceptor.Instance.Subscribers)
1616
{
1717
var scriptBlockSubscriber = subscriber as ScriptBlockOutputSubscriber;
1818
if (scriptBlockSubscriber != null)

Commands/ResumeLoggingCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class ResumeLoggingCommand : PSCmdlet
1111
{
1212
protected override void EndProcessing()
1313
{
14-
HostIoInterceptor.GetInterceptor().Paused = false;
14+
HostIOInterceptor.Instance.Paused = false;
1515
}
1616
} // End ResumeLoggingCommand class
1717
}

Commands/SuspendLoggingCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class SuspendLoggingCommand : PSCmdlet
1111
{
1212
protected override void EndProcessing()
1313
{
14-
HostIoInterceptor.GetInterceptor().Paused = true;
14+
HostIOInterceptor.Instance.Paused = true;
1515
}
1616
}
1717
}

0 commit comments

Comments
 (0)