Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1304,33 +1304,34 @@ public override void WriteWarningLine(string message)
/// </summary>
public override void WriteProgress(Int64 sourceId, ProgressRecord record)
{
if (record == null)
Dbg.Assert(record != null, "WriteProgress called with null ProgressRecord");

if (Console.IsOutputRedirected)
{
Dbg.Assert(false, "WriteProgress called with null ProgressRecord");
// Do not write progress bar when the stdout is redirected.
return;
}
else

bool matchPattern;
string currentOperation = HostUtilities.RemoveIdentifierInfoFromMessage(record.CurrentOperation, out matchPattern);
if (matchPattern)
{
bool matchPattern;
string currentOperation = HostUtilities.RemoveIdentifierInfoFromMessage(record.CurrentOperation, out matchPattern);
if (matchPattern)
{
record = new ProgressRecord(record) { CurrentOperation = currentOperation };
}
record = new ProgressRecord(record) { CurrentOperation = currentOperation };
}

// We allow only one thread at a time to update the progress state.)
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
{
PSObject obj = new PSObject();
obj.Properties.Add(new PSNoteProperty("SourceId", sourceId));
obj.Properties.Add(new PSNoteProperty("Record", record));
_parent.ErrorSerializer.Serialize(obj, "progress");
}
else
// We allow only one thread at a time to update the progress state.)
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
{
PSObject obj = new PSObject();
obj.Properties.Add(new PSNoteProperty("SourceId", sourceId));
obj.Properties.Add(new PSNoteProperty("Record", record));
_parent.ErrorSerializer.Serialize(obj, "progress");
}
else
{
lock (_instanceLock)
{
lock (_instanceLock)
{
HandleIncomingProgressRecord(sourceId, record);
}
HandleIncomingProgressRecord(sourceId, record);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ private void WriteContent()
if (_content is not null)
{
Console.CursorVisible = false;

var currentPosition = _rawui.CursorPosition;
_rawui.CursorPosition = _location;

Expand Down
2 changes: 1 addition & 1 deletion test/common/markdown/markdown-link.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Describe "Verify Markdown Links" {
catch [Microsoft.PowerShell.Commands.HttpResponseException]
{
if ( $allowedFailures -notcontains $_.Exception.Response.StatusCode ) {
throw "Failed to complete request to `"$url`". $($_.Exception.Message)"
throw "Failed to complete request to `"$url`". $($_.Exception.Response.StatusCode) $($_.Exception.Message)"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ Describe "Additional tests for Import-Module with WinCompat" -Tag "Feature" {

It "Verify that Warning is generated with default WarningAction" {
$LogPath = Join-Path $TestDrive (New-Guid).ToString()
& $pwsh -NoProfile -NonInteractive -c "[System.Management.Automation.Internal.InternalTestHooks]::SetTestHook('TestWindowsPowerShellPSHomeLocation', `'$basePath`');Import-Module $ModuleName" *> $LogPath
$LogPath | Should -FileContentMatch 'loaded in Windows PowerShell'
& $pwsh -NoProfile -NonInteractive -c "[System.Management.Automation.Internal.InternalTestHooks]::SetTestHook('TestWindowsPowerShellPSHomeLocation', `'$basePath`');Import-Module $ModuleName;Get-Error" *> $LogPath
$LogPath | Should -FileContentMatch 'loaded in Windows PowerShell' -Because (Get-Content $LogPath)
}

It "Verify that Error is Not generated with -ErrorAction Ignore" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Describe "WinRM based remoting session abrupt disconnect" -Tags 'Feature','Requi
} -ErrorAction SilentlyContinue

# Session should be disconnected.
$session.State | Should -BeExactly 'Disconnected'
$session.State | Should -BeLikeExactly 'Disconnect*'

# A disconnected job should have been created for reconnect.
$script:job = Get-Job | Where-Object { $_.ChildJobs[0].Runspace.Id -eq $session.Runspace.Id }
Expand Down