1
+ namespace CSharpInteractive . Core ;
2
+
3
+ using JetBrains . TeamCity . ServiceMessages ;
4
+ using JetBrains . TeamCity . ServiceMessages . Write . Special ;
5
+
6
+ internal class SafeTeamCityWriter ( ITeamCityWriter writer ) : ITeamCityWriter
7
+ {
8
+ private readonly object _lockObject = new ( ) ;
9
+
10
+ public ITeamCityWriter OpenBlock ( string blockName )
11
+ {
12
+ lock ( _lockObject )
13
+ {
14
+ return writer . OpenBlock ( blockName ) ;
15
+ }
16
+ }
17
+
18
+ public ITeamCityWriter OpenFlow ( )
19
+ {
20
+ lock ( _lockObject )
21
+ {
22
+ return writer . OpenFlow ( ) ;
23
+ }
24
+ }
25
+
26
+ public void WriteMessage ( string text )
27
+ {
28
+ lock ( _lockObject )
29
+ {
30
+ writer . WriteMessage ( text ) ;
31
+ }
32
+ }
33
+
34
+ public void WriteWarning ( string text )
35
+ {
36
+ writer . WriteWarning ( text ) ;
37
+ }
38
+
39
+ public void WriteError ( string text , string ? errorDetails = null )
40
+ {
41
+ lock ( _lockObject )
42
+ {
43
+ writer . WriteError ( text , errorDetails ) ;
44
+ }
45
+ }
46
+
47
+ public ITeamCityTestsSubWriter OpenTestSuite ( string suiteName )
48
+ {
49
+ lock ( _lockObject )
50
+ {
51
+ return writer . OpenTestSuite ( suiteName ) ;
52
+ }
53
+ }
54
+
55
+ public ITeamCityTestWriter OpenTest ( string testName )
56
+ {
57
+ lock ( _lockObject )
58
+ {
59
+ return writer . OpenTest ( testName ) ;
60
+ }
61
+ }
62
+
63
+ public ITeamCityWriter OpenCompilationBlock ( string compilerName )
64
+ {
65
+ lock ( _lockObject )
66
+ {
67
+ return writer . OpenCompilationBlock ( compilerName ) ;
68
+ }
69
+ }
70
+
71
+ public void PublishArtifact ( string rules )
72
+ {
73
+ lock ( _lockObject )
74
+ {
75
+ writer . PublishArtifact ( rules ) ;
76
+ }
77
+ }
78
+
79
+ public void WriteBuildNumber ( string buildNumber )
80
+ {
81
+ lock ( _lockObject )
82
+ {
83
+ writer . WriteBuildNumber ( buildNumber ) ;
84
+ }
85
+ }
86
+
87
+ public void WriteBuildProblem ( string identity , string description )
88
+ {
89
+ lock ( _lockObject )
90
+ {
91
+ writer . WriteBuildProblem ( identity , description ) ;
92
+ }
93
+ }
94
+
95
+ public void WriteBuildParameter ( string parameterName , string parameterValue )
96
+ {
97
+ lock ( _lockObject )
98
+ {
99
+ writer . WriteBuildParameter ( parameterName , parameterValue ) ;
100
+ }
101
+ }
102
+
103
+ public void WriteBuildStatistics ( string statisticsKey , string statisticsValue )
104
+ {
105
+ lock ( _lockObject )
106
+ {
107
+ writer . WriteBuildStatistics ( statisticsKey , statisticsValue ) ;
108
+ }
109
+ }
110
+
111
+ public void Dispose ( )
112
+ {
113
+ lock ( _lockObject )
114
+ {
115
+ writer . Dispose ( ) ;
116
+ }
117
+ }
118
+
119
+ public void WriteRawMessage ( IServiceMessage message )
120
+ {
121
+ lock ( _lockObject )
122
+ {
123
+ writer . WriteRawMessage ( message ) ;
124
+ }
125
+ }
126
+ }
0 commit comments