-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PowerShell code cleanup and partial fix for signaling command failure (…
…#3150) * cleanup * fix one case where CommandFailed isn't sent when pwsh submission fails This also adds another test case that can't pass until a PowerShell bug is fixed: PowerShell/PowerShell#20079 * use generalized API for requesting input * update PowerShell package version
- Loading branch information
1 parent
f23f935
commit 2ebbb6a
Showing
14 changed files
with
138 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/Microsoft.DotNet.Interactive.PowerShell/Host/ConsoleColorProxy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.DotNet.Interactive.PowerShell.Host; | ||
|
||
internal class ConsoleColorProxy | ||
{ | ||
private readonly PSKernelHostUserInterface _ui; | ||
|
||
public ConsoleColorProxy(PSKernelHostUserInterface ui) | ||
{ | ||
_ui = ui ?? throw new ArgumentNullException(nameof(ui)); | ||
} | ||
|
||
public ConsoleColor FormatAccentColor | ||
{ | ||
get => _ui.FormatAccentColor; | ||
set => _ui.FormatAccentColor = value; | ||
} | ||
|
||
public ConsoleColor ErrorAccentColor | ||
{ | ||
get => _ui.ErrorAccentColor; | ||
set => _ui.ErrorAccentColor = value; | ||
} | ||
|
||
public ConsoleColor ErrorForegroundColor | ||
{ | ||
get => _ui.ErrorForegroundColor; | ||
set => _ui.ErrorForegroundColor = value; | ||
} | ||
|
||
public ConsoleColor ErrorBackgroundColor | ||
{ | ||
get => _ui.ErrorBackgroundColor; | ||
set => _ui.ErrorBackgroundColor = value; | ||
} | ||
|
||
public ConsoleColor WarningForegroundColor | ||
{ | ||
get => _ui.WarningForegroundColor; | ||
set => _ui.WarningForegroundColor = value; | ||
} | ||
|
||
public ConsoleColor WarningBackgroundColor | ||
{ | ||
get => _ui.WarningBackgroundColor; | ||
set => _ui.WarningBackgroundColor = value; | ||
} | ||
|
||
public ConsoleColor DebugForegroundColor | ||
{ | ||
get => _ui.DebugForegroundColor; | ||
set => _ui.DebugForegroundColor = value; | ||
} | ||
|
||
public ConsoleColor DebugBackgroundColor | ||
{ | ||
get => _ui.DebugBackgroundColor; | ||
set => _ui.DebugBackgroundColor = value; | ||
} | ||
|
||
public ConsoleColor VerboseForegroundColor | ||
{ | ||
get => _ui.VerboseForegroundColor; | ||
set => _ui.VerboseForegroundColor = value; | ||
} | ||
|
||
public ConsoleColor VerboseBackgroundColor | ||
{ | ||
get => _ui.VerboseBackgroundColor; | ||
set => _ui.VerboseBackgroundColor = value; | ||
} | ||
|
||
public ConsoleColor ProgressForegroundColor | ||
{ | ||
get => _ui.ProgressForegroundColor; | ||
set => _ui.ProgressForegroundColor = value; | ||
} | ||
|
||
public ConsoleColor ProgressBackgroundColor | ||
{ | ||
get => _ui.ProgressBackgroundColor; | ||
set => _ui.ProgressBackgroundColor = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 5 additions & 63 deletions
68
src/Microsoft.DotNet.Interactive.PowerShell/PowerShellExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.