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

InnerJob.HadErrors doesn't exist in PowerShell v2 #64

Closed
ALuckyGuy opened this issue Apr 5, 2016 · 5 comments
Closed

InnerJob.HadErrors doesn't exist in PowerShell v2 #64

ALuckyGuy opened this issue Apr 5, 2016 · 5 comments

Comments

@ALuckyGuy
Copy link

In PoshRSJob.Types.ps1xml, the following reference to HadErrors is invalid:

<Types>
  <Type>
    <Name>PoshRS.PowerShell.RSJob</Name>
    <Members>
      <ScriptProperty>
        <Name>HasErrors</Name>
        <GetScriptBlock>
          $this.innerjob.HadErrors
        </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>

Unfortunately, HadErrors wasn't introduced until v3 - System.Management.Automation.PowerShell

There reference causes the following error:
Property 'HadErrors' cannot be found on this object. Make sure that it exists.

@proxb
Copy link
Owner

proxb commented Apr 7, 2016

That's unfortunate. I guess I'll throw in a try/catch to handle that issue.

@proxb proxb self-assigned this Apr 7, 2016
@ALuckyGuy
Copy link
Author

Not sure if it's the best way but this seems to work:

<Type>
  <Name>PoshRS.PowerShell.RSJob</Name>
  <Members>
    <ScriptProperty>
      <Name>HasErrors</Name>
      <GetScriptBlock>
         if ($psversiontable.psversion.major -ge 3){ 
            $this.innerjob.HadErrors 
         }else{ 
            ($this.innerjob.Streams.Error -ne $null)
         }
      </GetScriptBlock>
    </ScriptProperty>
  </Members>
</Type>

@proxb proxb added the Ready label Apr 7, 2016
proxb added a commit that referenced this issue Apr 8, 2016
@proxb
Copy link
Owner

proxb commented Apr 8, 2016

The latest update should resolve this. Can you test and verify for me?

@proxb proxb added this to the 1.5.6.1 milestone Apr 8, 2016
@ALuckyGuy
Copy link
Author

I'll take a look at it and get back with you.

@ALuckyGuy
Copy link
Author

This seems to be working.Closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants