From cb0e91fd52d1af44014d2870daddb1a84ed4471d Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Wed, 14 Mar 2018 12:09:26 -0400 Subject: [PATCH] throw on pipe on windows --- terminal.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminal.d b/terminal.d index 702bced..479b343 100644 --- a/terminal.d +++ b/terminal.d @@ -794,7 +794,8 @@ http://msdn.microsoft.com/en-us/library/windows/desktop/ms683193%28v=vs.85%29.as hConsole = GetStdHandle(STD_OUTPUT_HANDLE); } - GetConsoleScreenBufferInfo(hConsole, &originalSbi); + if(GetConsoleScreenBufferInfo(hConsole, &originalSbi) == 0) + throw new Exception("not a user-interactive terminal"); } // only use this if you are sure you know what you want, since the terminal is a shared resource you generally really want to reset it to normal when you leave...