summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi M. Obenour <demiobenour@gmail.com>2020-12-28 18:33:22 -0500
committerJulian Andres Klode <jak@debian.org>2025-05-19 17:06:31 +0000
commit1eb729ef1c795f6b5944dd217994f8d8279672bc (patch)
tree7fcab49925442011d731acbbfd90934ed5712f09
parentfb57847947daa41291e87ce2a9e66e8dcca104b3 (diff)
Fail on stdio errors
If there is an error writing to cout, cerr, or clog, APT should return a non-zero exit code. This allows automated tools to reliably check for warnings.
-rw-r--r--apt-private/private-cmndline.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index 67a34a2c7..e16aa7280 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -622,7 +622,7 @@ unsigned short DispatchCommandLine(CommandLine &CmdL, std::vector<CommandLine::D
_error->DumpErrors();
else
_error->DumpErrors(GlobalError::NOTICE);
- if (returned == false)
+ if (returned == false || std::cout.bad() || std::cerr.bad() || std::clog.bad())
return 100;
return Errors == true ? 100 : 0;
}