@@ -47,11 +47,11 @@ func TestFaultyDoubleRunWait(t *testing.T) {
47
47
Timeout : time .Second ,
48
48
}
49
49
50
- err := command .Run (context .Background ())
50
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
51
51
52
52
assertive .ErrorIsNil (t , err )
53
53
54
- err = command .Run (context .Background ())
54
+ err = command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
55
55
56
56
assertive .ErrorIs (t , err , com .ErrExecAlreadyStarted )
57
57
@@ -73,7 +73,7 @@ func TestFaultyRunDoubleWait(t *testing.T) {
73
73
Timeout : time .Second ,
74
74
}
75
75
76
- err := command .Run (context .Background ())
76
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
77
77
78
78
assertive .ErrorIsNil (t , err )
79
79
@@ -99,11 +99,11 @@ func TestFailRun(t *testing.T) {
99
99
Binary : "does-not-exist" ,
100
100
}
101
101
102
- err := command .Run (context .Background ())
102
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
103
103
104
104
assertive .ErrorIs (t , err , com .ErrFailedStarting )
105
105
106
- err = command .Run (context .Background ())
106
+ err = command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
107
107
108
108
assertive .ErrorIs (t , err , com .ErrExecAlreadyFinished )
109
109
@@ -130,7 +130,7 @@ func TestBasicRunWait(t *testing.T) {
130
130
Args : []string {"one" },
131
131
}
132
132
133
- err := command .Run (context .Background ())
133
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
134
134
135
135
assertive .ErrorIsNil (t , err )
136
136
@@ -150,7 +150,7 @@ func TestBasicFail(t *testing.T) {
150
150
Args : []string {"-c" , "--" , "does-not-exist" },
151
151
}
152
152
153
- err := command .Run (context .Background ())
153
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
154
154
155
155
assertive .ErrorIsNil (t , err )
156
156
@@ -171,7 +171,7 @@ func TestWorkingDir(t *testing.T) {
171
171
WorkingDir : dir ,
172
172
}
173
173
174
- err := command .Run (context .Background ())
174
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
175
175
176
176
assertive .ErrorIsNil (t , err )
177
177
@@ -198,7 +198,7 @@ func TestEnvBlacklist(t *testing.T) {
198
198
Binary : "env" ,
199
199
}
200
200
201
- err := command .Run (context .Background ())
201
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
202
202
203
203
assertive .ErrorIsNil (t , err )
204
204
@@ -214,7 +214,7 @@ func TestEnvBlacklist(t *testing.T) {
214
214
EnvBlackList : []string {"FOO" },
215
215
}
216
216
217
- err = command .Run (context .Background ())
217
+ err = command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
218
218
219
219
assertive .ErrorIsNil (t , err )
220
220
@@ -238,7 +238,8 @@ func TestEnvBlacklist(t *testing.T) {
238
238
EnvBlackList : []string {"*" },
239
239
}
240
240
241
- err = command .Run (context .Background ())
241
+ err = command .Run (context .WithValue (context .Background (), com .LoggerKey , t ))
242
+
242
243
assertive .ErrorIsNil (t , err )
243
244
244
245
res , err = command .Wait ()
@@ -263,7 +264,7 @@ func TestEnvAdd(t *testing.T) {
263
264
EnvBlackList : []string {"BLED" },
264
265
}
265
266
266
- err := command .Run (context .Background ())
267
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
267
268
268
269
assertive .ErrorIsNil (t , err )
269
270
@@ -285,7 +286,7 @@ func TestStdoutStderr(t *testing.T) {
285
286
Args : []string {"-c" , "--" , "printf onstdout; >&2 printf onstderr;" },
286
287
}
287
288
288
- err := command .Run (context .Background ())
289
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
289
290
290
291
assertive .ErrorIsNil (t , err )
291
292
@@ -309,7 +310,7 @@ func TestTimeoutPlain(t *testing.T) {
309
310
Timeout : 1 * time .Second ,
310
311
}
311
312
312
- err := command .Run (context .Background ())
313
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
313
314
314
315
assertive .ErrorIsNil (t , err )
315
316
@@ -336,7 +337,7 @@ func TestTimeoutDelayed(t *testing.T) {
336
337
Timeout : 1 * time .Second ,
337
338
}
338
339
339
- err := command .Run (context .Background ())
340
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
340
341
341
342
assertive .ErrorIsNil (t , err )
342
343
@@ -372,7 +373,7 @@ func TestPTYStdout(t *testing.T) {
372
373
373
374
command .WithPTY (false , true , false )
374
375
375
- err := command .Run (context .Background ())
376
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
376
377
377
378
assertive .ErrorIsNil (t , err )
378
379
@@ -403,7 +404,7 @@ func TestPTYStderr(t *testing.T) {
403
404
404
405
command .WithPTY (false , false , true )
405
406
406
- err := command .Run (context .Background ())
407
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
407
408
408
409
assertive .ErrorIsNil (t , err )
409
410
@@ -432,7 +433,7 @@ func TestPTYBoth(t *testing.T) {
432
433
433
434
command .WithPTY (true , true , true )
434
435
435
- err := command .Run (context .Background ())
436
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
436
437
437
438
assertive .ErrorIsNil (t , err )
438
439
@@ -465,7 +466,7 @@ func TestWriteStdin(t *testing.T) {
465
466
command .Feed (strings .NewReader ("hello world\n " ))
466
467
command .Feed (strings .NewReader ("hello again\n " ))
467
468
468
- err := command .Run (context .Background ())
469
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
469
470
470
471
assertive .ErrorIsNil (t , err )
471
472
@@ -500,7 +501,7 @@ func TestWritePTYStdin(t *testing.T) {
500
501
command .Feed (strings .NewReader ("hello world" ))
501
502
command .Feed (strings .NewReader ("hello again" ))
502
503
503
- err := command .Run (context .Background ())
504
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
504
505
505
506
assertive .ErrorIsNil (t , err )
506
507
@@ -521,7 +522,7 @@ func TestSignalOnCompleted(t *testing.T) {
521
522
Timeout : 3 * time .Second ,
522
523
}
523
524
524
- err := command .Run (context .Background ())
525
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
525
526
526
527
assertive .ErrorIsNil (t , err )
527
528
@@ -546,7 +547,7 @@ func TestSignalOnCompleted(t *testing.T) {
546
547
// Timeout: 3 * time.Second,
547
548
// }
548
549
//
549
- // err := command.Run(context.Background())
550
+ // err := command.Run(context.WithValue(context. Background(), com.LoggerKey, t ))
550
551
//
551
552
// assertive.ErrorIsNil(t, err)
552
553
//
@@ -580,7 +581,7 @@ func TestSignalNormal(t *testing.T) {
580
581
Timeout : 3 * time .Second ,
581
582
}
582
583
583
- err := command .Run (context .Background ())
584
+ err := command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
584
585
585
586
assertive .ErrorIsNil (t , err )
586
587
@@ -605,7 +606,7 @@ func TestSignalNormal(t *testing.T) {
605
606
Timeout : 3 * time .Second ,
606
607
}
607
608
608
- err = command .Run (context .Background ())
609
+ err = command .Run (context .WithValue ( context . Background (), com . LoggerKey , t ))
609
610
610
611
assertive .ErrorIsNil (t , err )
611
612
0 commit comments