@@ -54,6 +54,7 @@ interface IProcessTask<TData, T> : ITask<TData, T>, IProcess
54
54
55
55
class ProcessWrapper
56
56
{
57
+ private readonly string taskName ;
57
58
private readonly IOutputProcessor outputProcessor ;
58
59
private readonly Action onStart ;
59
60
private readonly Action onEnd ;
@@ -67,10 +68,11 @@ class ProcessWrapper
67
68
private ILogging logger ;
68
69
protected ILogging Logger { get { return logger = logger ?? LogHelper . GetLogger ( GetType ( ) ) ; } }
69
70
70
- public ProcessWrapper ( Process process , IOutputProcessor outputProcessor ,
71
+ public ProcessWrapper ( string taskName , Process process , IOutputProcessor outputProcessor ,
71
72
Action onStart , Action onEnd , Action < Exception , string > onError ,
72
73
CancellationToken token )
73
74
{
75
+ this . taskName = taskName ;
74
76
this . outputProcessor = outputProcessor ;
75
77
this . onStart = onStart ;
76
78
this . onEnd = onEnd ;
@@ -102,8 +104,7 @@ public void Run()
102
104
103
105
try
104
106
{
105
- if ( ! Process . StartInfo . Arguments . StartsWith ( "credential-" ) )
106
- Logger . Trace ( $ "Running '{ Process . StartInfo . FileName . ToNPath ( ) . FileName } { Process . StartInfo . Arguments } '") ;
107
+ Logger . Trace ( $ "Running '{ Process . StartInfo . FileName . ToNPath ( ) . FileName } { taskName } '") ;
107
108
108
109
Process . Start ( ) ;
109
110
@@ -158,6 +159,10 @@ public void Run()
158
159
var errorCode = ex . NativeErrorCode ;
159
160
160
161
StringBuilder sb = new StringBuilder ( ) ;
162
+ if ( Process . StartInfo . Arguments . Contains ( "-credential" ) )
163
+ sb . AppendLine ( $ "'{ Process . StartInfo . FileName } { taskName } '") ;
164
+ else
165
+ sb . AppendLine ( $ "'{ Process . StartInfo . FileName } { Process . StartInfo . Arguments } '") ;
161
166
if ( errorCode == 2 )
162
167
sb . AppendLine ( "The system cannot find the file specified." ) ;
163
168
foreach ( string env in Process . StartInfo . EnvironmentVariables . Keys )
@@ -240,6 +245,7 @@ public virtual void Configure(ProcessStartInfo psi)
240
245
Guard . NotNull ( this , outputProcessor , nameof ( outputProcessor ) ) ;
241
246
Process = new Process { StartInfo = psi , EnableRaisingEvents = true } ;
242
247
ProcessName = psi . FileName ;
248
+ Name = ProcessArguments ;
243
249
}
244
250
245
251
public virtual void Configure ( ProcessStartInfo psi , IOutputProcessor < T > processor )
@@ -251,6 +257,7 @@ public virtual void Configure(ProcessStartInfo psi, IOutputProcessor<T> processo
251
257
252
258
Process = new Process { StartInfo = psi , EnableRaisingEvents = true } ;
253
259
ProcessName = psi . FileName ;
260
+ Name = ProcessArguments ;
254
261
}
255
262
256
263
public void Configure ( Process existingProcess )
@@ -263,6 +270,7 @@ public void Configure(Process existingProcess)
263
270
264
271
Process = existingProcess ;
265
272
ProcessName = existingProcess . StartInfo . FileName ;
273
+ Name = ProcessArguments ;
266
274
}
267
275
268
276
protected override void RaiseOnStart ( )
@@ -285,7 +293,7 @@ protected override T RunWithReturn(bool success)
285
293
{
286
294
var result = base . RunWithReturn ( success ) ;
287
295
288
- wrapper = new ProcessWrapper ( Process , outputProcessor ,
296
+ wrapper = new ProcessWrapper ( Name , Process , outputProcessor ,
289
297
RaiseOnStart ,
290
298
( ) =>
291
299
{
@@ -421,7 +429,7 @@ protected override List<T> RunWithReturn(bool success)
421
429
{
422
430
var result = base . RunWithReturn ( success ) ;
423
431
424
- wrapper = new ProcessWrapper ( Process , outputProcessor ,
432
+ wrapper = new ProcessWrapper ( Name , Process , outputProcessor ,
425
433
RaiseOnStart ,
426
434
( ) =>
427
435
{
0 commit comments