summaryrefslogtreecommitdiffstats
path: root/src/main.lib/Services/InputService.cs
diff options
context:
space:
mode:
authorWouter Tinus <win.acme.simple@gmail.com>2019-11-25 06:36:43 +0100
committerWouter Tinus <win.acme.simple@gmail.com>2019-11-25 06:36:43 +0100
commit3d799d216195f5b021ffd8aa82ff9fd932e2b564 (patch)
tree71ac7eaa5c2a0656e25f615c448c6258209aff90 /src/main.lib/Services/InputService.cs
parent1095836dc2cd53ed5074e3bd69e9a7aaba717354 (diff)
downloadletsencrypt-win-simple-3d799d216195f5b021ffd8aa82ff9fd932e2b564.zip
letsencrypt-win-simple-3d799d216195f5b021ffd8aa82ff9fd932e2b564.tar.gz
letsencrypt-win-simple-3d799d216195f5b021ffd8aa82ff9fd932e2b564.tar.bz2
Fix output redirection bug
Diffstat (limited to 'src/main.lib/Services/InputService.cs')
-rw-r--r--src/main.lib/Services/InputService.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.lib/Services/InputService.cs b/src/main.lib/Services/InputService.cs
index 778a92f..d1a83e0 100644
--- a/src/main.lib/Services/InputService.cs
+++ b/src/main.lib/Services/InputService.cs
@@ -163,13 +163,21 @@ namespace PKISharp.WACS.Services
var inputStream = Console.OpenStandardInput(bufferSize);
Console.SetIn(new StreamReader(inputStream, Console.InputEncoding, false, bufferSize));
- var top = Console.CursorTop;
- var left = Console.CursorLeft;
- var answer = Console.ReadLine();
+ int top = default;
+ int left = default;
+ if (!Console.IsOutputRedirected)
+ {
+ top = Console.CursorTop;
+ left = Console.CursorLeft;
+ }
+ var answer = Console.ReadLine();
if (string.IsNullOrWhiteSpace(answer))
{
- Console.SetCursorPosition(left, top);
+ if (!Console.IsOutputRedirected)
+ {
+ Console.SetCursorPosition(left, top);
+ }
Console.WriteLine("<Enter>");
Console.WriteLine();
return Task.FromResult(string.Empty);