From 22a9bbac1aaaca802acec79c916abd64f820f50b Mon Sep 17 00:00:00 2001 From: Ken Shirriff Date: Sat, 18 Nov 2017 17:11:34 -0800 Subject: [PATCH] Don't use console if redirected. This is a brute-force solution, but the existing console code will hit errors if there is no console. --- PUP/Console/Console.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PUP/Console/Console.cs b/PUP/Console/Console.cs index 9c5965f..d9c947f 100644 --- a/PUP/Console/Console.cs +++ b/PUP/Console/Console.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Text; -using System.IO; +using System.Threading; namespace IFS.IfsConsole { @@ -162,6 +162,13 @@ namespace IFS.IfsConsole public void Run() { + if (Console.IsOutputRedirected || Console.IsInputRedirected) + { + // No console, so just run forever. + Thread.Sleep(Timeout.Infinite); + return; + } + bool exit = false; while (!exit) {