Skip to content

Commit

Permalink
Simplify removing escape codes from PowerShell console output
Browse files Browse the repository at this point in the history
Instead of using the decorated string rely on the PSHostUserInterface
GetOutputString method which can remove escape codes.
  • Loading branch information
mrward committed May 21, 2022
1 parent f4d927c commit 7fa3270
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Management.Automation.Host;
using System.Management.Automation.Internal;
using System.Security;
using System.Text;
using MonoDevelop.PackageManagement.Scripting;
Expand Down Expand Up @@ -174,8 +173,7 @@ public override void WriteWarningLine (string message)
/// </summary>
static string RemoveEscapeCodes (string text)
{
var decorated = new StringDecorated (text);
return decorated.ToString ();
return GetOutputString (text, supportsVirtualTerminal: false);
}

public ConsoleColor FormatAccentColor { get; set; } = ConsoleColor.Green;
Expand Down

0 comments on commit 7fa3270

Please sign in to comment.