Commit 9fcb95a
committed
fix(cli): write notices to stderr or don't write them at all
On CI systems, the CDK CLI tries to avoid writing to `stderr` because
there are a couple of CI systems that are commonly configured to fail if
any output is written to `stderr`. That means all output, like notices,
must go to `stdout`.
Some commands (like `cdk synth` or `cdk bootstrap --show-template`)
produce usable output on `stdout`, and these are commonly scripted, like
piping their output to a file.
However, because notices must go to `stdout`, these now interfere with
the output of these commands.
This needs a more thorough reworking of the CLI output streams, but
there is a risk of affecting users who are currently relying on the fact
that all output goes to `stdout`.
In this PR, we are doing the first steps to solving this situation:
- Notices will always go to `stderr`, so that they will never interfere
with `stdout` anymore.
- We try to detect what CI system we are running on, and we will
completely suppress notices *unless* we determine that we are running
on a CI system where it is "safe" to write to `sterr` (fail closed).
"Safe" in this case means that the CI system doesn't come with an easy
to toggle checkbox that makes commands fail based on what they print,
instead of their exit codes. The only systems I'm aware of that have
this checkbox are "Azure DevOps", and "TeamCity running PowerShell
scripts".
Even though we know the systems that are "unsafe", we will only
show notices on systems known to be "safe".
Fixes aws/aws-cdk#33589.1 parent faa2de0 commit 9fcb95a
File tree
5 files changed
+194
-34
lines changed- packages
- @aws-cdk/toolkit-lib/lib/api/io/private
- aws-cdk/lib
- cli
- toolkit
5 files changed
+194
-34
lines changedLines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
209 | 231 | | |
210 | 232 | | |
211 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
96 | | - | |
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
| |||
458 | 472 | | |
459 | 473 | | |
460 | 474 | | |
461 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
462 | 481 | | |
463 | 482 | | |
464 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 39 | | |
47 | 40 | | |
48 | 41 | | |
| |||
298 | 291 | | |
299 | 292 | | |
300 | 293 | | |
301 | | - | |
302 | 294 | | |
303 | 295 | | |
304 | 296 | | |
| |||
313 | 305 | | |
314 | 306 | | |
315 | 307 | | |
316 | | - | |
317 | 308 | | |
318 | 309 | | |
319 | 310 | | |
| |||
339 | 330 | | |
340 | 331 | | |
341 | 332 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | 333 | | |
347 | 334 | | |
348 | 335 | | |
| |||
357 | 344 | | |
358 | 345 | | |
359 | 346 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | 347 | | |
365 | 348 | | |
366 | 349 | | |
| |||
369 | 352 | | |
370 | 353 | | |
371 | 354 | | |
372 | | - | |
373 | | - | |
374 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
375 | 363 | | |
376 | | - | |
| 364 | + | |
377 | 365 | | |
378 | 366 | | |
379 | | - | |
| 367 | + | |
380 | 368 | | |
381 | 369 | | |
382 | | - | |
| 370 | + | |
383 | 371 | | |
384 | 372 | | |
385 | | - | |
| 373 | + | |
| 374 | + | |
386 | 375 | | |
387 | | - | |
388 | 376 | | |
389 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
390 | 381 | | |
391 | 382 | | |
392 | 383 | | |
393 | | - | |
394 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
395 | 388 | | |
396 | 389 | | |
397 | 390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
| |||
189 | 194 | | |
190 | 195 | | |
191 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
192 | 205 | | |
193 | 206 | | |
194 | 207 | | |
| |||
379 | 392 | | |
380 | 393 | | |
381 | 394 | | |
382 | | - | |
383 | | - | |
| 395 | + | |
| 396 | + | |
384 | 397 | | |
385 | 398 | | |
386 | 399 | | |
| |||
394 | 407 | | |
395 | 408 | | |
396 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
397 | 421 | | |
398 | 422 | | |
399 | 423 | | |
400 | | - | |
| 424 | + | |
401 | 425 | | |
402 | 426 | | |
403 | 427 | | |
| |||
506 | 530 | | |
507 | 531 | | |
508 | 532 | | |
509 | | - | |
| 533 | + | |
510 | 534 | | |
511 | 535 | | |
512 | 536 | | |
| |||
568 | 592 | | |
569 | 593 | | |
570 | 594 | | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
0 commit comments