Have `pub deps --json` quiet when no terminal is attached (#4602)
diff --git a/lib/src/command/deps.dart b/lib/src/command/deps.dart index c3cd18f..32c0a0b 100644 --- a/lib/src/command/deps.dart +++ b/lib/src/command/deps.dart
@@ -99,7 +99,12 @@ ]; final toVisit = [...workspacePackageNames]; final packagesJson = <dynamic>[]; - final graph = await entrypoint.packageGraph; + + // Avoid polluting stdout when outputting json. + final graph = await log.errorsOnlyUnlessTerminal( + () async => await entrypoint.packageGraph, + ); + while (toVisit.isNotEmpty) { final current = toVisit.removeLast(); if (visited.contains(current)) continue;