From 1eb729ef1c795f6b5944dd217994f8d8279672bc Mon Sep 17 00:00:00 2001 From: "Demi M. Obenour" Date: Mon, 28 Dec 2020 18:33:22 -0500 Subject: 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. --- apt-private/private-cmndline.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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::vectorDumpErrors(); 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; } -- cgit v1.2.3-70-g09d2