Skip to content

Commit

Permalink
(consoleapp) Remove winpty hack (#286)
Browse files Browse the repository at this point in the history
Introduced in #278, no longer needed. See #285 for more details.
  • Loading branch information
perlun authored Feb 21, 2022
1 parent f84b8da commit f921471
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/Perlang.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static int MainWithCustomConsole(string[] args, IConsole console)
replMode: true,
standardOutputHandler: console.Out.WriteLine,
disabledWarningsAsErrors: disabledWarningsAsErrorsList
).RunPrompt(args);
).RunPrompt();

return Task.FromResult(0);
}
Expand Down Expand Up @@ -332,20 +332,8 @@ private int RunFile(string path)
return (int)ExitCodes.SUCCESS;
}

#pragma warning disable S1172 // Remove this unused method parameter 'args'.
private void RunPrompt(string[] args)
private void RunPrompt()
{
#if _WINDOWS
if (Console.IsInputRedirected)
{
Console.WriteLine("Input redirection detected, relaunching with winpty");
var process = Process.Start("winpty", Environment.ProcessPath! + String.Join(' ', args));
process!.WaitForExit();

return;
}
#endif

PrintBanner();
ReadLine.HistoryEnabled = true;
ReadLine.AutoCompletionHandler = new AutoCompletionHandler();
Expand All @@ -370,7 +358,6 @@ private void RunPrompt(string[] args)
Run(command, CompilerWarningAsWarning);
}
}
#pragma warning restore S1172

private void ShowHelp()
{
Expand Down

0 comments on commit f921471

Please sign in to comment.