Skip to content

Commit

Permalink
v1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
nightroman committed Jan 23, 2014
1 parent 7bd2608 commit d800a98
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .build.ps1
Expand Up @@ -66,8 +66,9 @@ task TestHelp Help, {
Test-Helps Module\en-US\SplitPipeline.dll-Help.ps1
}

# Tests.
# Tests v2 and v3.
task Test {
exec { PowerShell.exe -Version 2 Invoke-Build ** Tests }
Invoke-Build ** Tests
}

Expand Down
2 changes: 1 addition & 1 deletion Module/SplitPipeline.psd1
@@ -1,7 +1,7 @@

@{
Author = 'Roman Kuzmin'
ModuleVersion = '1.4.2'
ModuleVersion = '1.4.3'
CompanyName = 'https://github.com/nightroman/SplitPipeline'
Copyright = '(C) 2011-2014 Roman Kuzmin. All rights reserved.'
Description = 'SplitPipeline - Parallel Data Processing in PowerShell'
Expand Down
4 changes: 4 additions & 0 deletions Release-Notes.md
@@ -1,6 +1,10 @@
SplitPipeline Release Notes
===========================

## v1.4.3

Fixed duplicated debug, warning, and verbose messages (v1.4.2).

## v1.4.2

Pipeline runspaces are created with the host used by `Split-Pipeline`. As a
Expand Down
2 changes: 1 addition & 1 deletion Src/AssemblyInfo.cs
Expand Up @@ -4,7 +4,7 @@
using System.Runtime.InteropServices;

[assembly: AssemblyProduct("SplitPipeline")]
[assembly: AssemblyVersion("1.4.2")]
[assembly: AssemblyVersion("1.4.3")]
[assembly: AssemblyCopyright("Copyright (c) 2011-2014 Roman Kuzmin")]
[assembly: AssemblyCompany("https://github.com/nightroman/SplitPipeline")]
[assembly: AssemblyTitle("SplitPipeline - Parallel Data Processing in PowerShell")]
Expand Down
34 changes: 12 additions & 22 deletions Src/SplitPipelineCommand.cs
Expand Up @@ -359,6 +359,7 @@ void Feed(bool force)
LinkedListNode<Job> node = _done.First;
if (node == null)
{
// v1.4.2 Runspaces use the same host as the cmdlet.
var job = new Job(RunspaceFactory.CreateRunspace(Host, _iss));
node = new LinkedListNode<Job>(job);
_work.AddLast(node);
Expand Down Expand Up @@ -450,8 +451,12 @@ void Wait()
/// Writes job output objects and propagates streams.
/// Moves refilling objects from output to the queue.
/// </summary>
/// <remarks>
/// v1.4.2 Only errors are propagated, other streams are written to the host.
/// </remarks>
void WriteResults(Job job, ICollection<PSObject> output)
{
// process output
if (output != null && output.Count > 0)
{
if (Refill)
Expand All @@ -475,35 +480,20 @@ void WriteResults(Job job, ICollection<PSObject> output)
}
}

// process streams
var streams = job.Streams;

if (streams.Debug.Count > 0)
{
foreach (var record in streams.Debug)
WriteDebug(record.Message);
streams.Debug.Clear();
}

if (streams.Verbose.Count > 0)
{
foreach (var record in streams.Verbose)
WriteVerbose(record.Message);
streams.Verbose.Clear();
}

if (streams.Warning.Count > 0)
{
foreach (var record in streams.Warning)
WriteWarning(record.Message);
streams.Warning.Clear();
}

// v1.4.2 Even with the shared host errors must be propagated explicitly.
if (streams.Error.Count > 0)
{
foreach (var record in streams.Error)
WriteError(record);
streams.Error.Clear();
}

// v1.4.2 Debug, progress, verbose, and warning messages are written to the host.
// But streams are still populated, so we clear them on writing results.
// NB: It is possible to log these streams in addition.
streams.ClearStreams();
}
/// <summary>
/// Moves all jobs to done then for each jobs:
Expand Down
14 changes: 7 additions & 7 deletions Tests/Scripts.test.ps1
Expand Up @@ -35,28 +35,28 @@ task BeginProcessEnd {
$DebugPreference = 'Continue'
$result = 1..4 | Split-Pipeline -Count 2 -Load 1 -Verbose `
-Begin {
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'
$VerbosePreference = 'Continue'
'begin split'
Write-Warning 'Warning in begin split'
Write-Verbose 'Verbose in begin split'
Write-Debug 'Debug in begin split'
Write-Error 'Error in begin split'
Write-Verbose 'Verbose in begin split'
Write-Warning 'Warning in begin split'
} `
-End {
'end split'
Write-Warning 'Warning in end split'
Write-Verbose 'Verbose in end split'
Write-Debug 'Debug in end split'
Write-Error 'Error in end split'
Write-Verbose 'Verbose in end split'
Write-Warning 'Warning in end split'
} `
-Script {
begin {
'begin part'
Write-Warning 'Warning in script'
Write-Verbose 'Verbose in script'
Write-Debug 'Debug in script'
Write-Error 'Error in script'
Write-Verbose 'Verbose in script'
Write-Warning 'Warning in script'
}
process {
$_
Expand Down
3 changes: 3 additions & 0 deletions Tests/Test-Stopping-Random.ps1
Expand Up @@ -71,7 +71,10 @@ for($n = 1; $n -le $Repeat; ++$n) {
[SplitPipelineLog]::Finally.Clear()

# start Split-Pipeline
$rs = [runspacefactory]::CreateRunspace($Host)
$rs.Open()
$ps = [PowerShell]::Create()
$ps.Runspace = $rs
$null = $ps.AddScript($test)
$a1 = $ps.BeginInvoke()

Expand Down

0 comments on commit d800a98

Please sign in to comment.