Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(consoleapp) Remove winpty hack #286

Merged
merged 1 commit into from
Feb 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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