Running psake creates global $psake variable #113

Closed
togakangaroo opened this Issue Jun 4, 2014 · 2 comments

Comments

Projects
None yet
3 participants
@togakangaroo
  Invoke-Psake anyFile.ps1 anyTask

you'll notice that after this has completed, there is now a $psake variable polluting the global variable space.

@nightroman

This comment has been minimized.

Show comment
Hide comment
@nightroman

nightroman Jun 5, 2014

Contributor

It is also enough to import the module in order to get this variable

ipmo C:\TEMP\psake\psake.psm1
$psake

But this is probably by design and documented. See psake.psm1:

export-modulemember -function ... -variable psake

In order to get rid of the variable, remove the module:

Remove-Module psake
Contributor

nightroman commented Jun 5, 2014

It is also enough to import the module in order to get this variable

ipmo C:\TEMP\psake\psake.psm1
$psake

But this is probably by design and documented. See psake.psm1:

export-modulemember -function ... -variable psake

In order to get rid of the variable, remove the module:

Remove-Module psake
@damianh

This comment has been minimized.

Show comment
Hide comment
@damianh

damianh Nov 19, 2014

Contributor

You will notice that some people are accessing that variable after their script has run: #119

As @nightroman says, by design and removing the module removes the variable.

Contributor

damianh commented Nov 19, 2014

You will notice that some people are accessing that variable after their script has run: #119

As @nightroman says, by design and removing the module removes the variable.

@damianh damianh closed this Nov 19, 2014

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