You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While doing Powershell development on Linux I encountered an issue running a psakefile.ps1.
The component:
...
Task GitPull {
Exec { git pull }
}
...
Expected Behavior
❯ invoke-psake GitPull
psake version 4.9.0
Copyright (c) 2010-2018 James Kovacs & Contributors
Executing GitPull
Already up to date.
psake succeeded executing psakefile.ps1
----------------------------------------------------------------------
Build Time Report
----------------------------------------------------------------------
Name Duration
---- --------
GitPull 00:00:01.370
Total: 00:00:01.385
Current Behavior
❯ invoke-psake GitPull
psake version 4.9.0
Copyright (c) 2010-2018 James Kovacs & Contributors
Executing GitPull
Error: 2022-12-01 1:24:56 p.m.:
At /home/paulhey/Projects/labcollector/psakefile.ps1:377 char:3 + Exec { git pull } + ~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Command '' was not found. The specified command must be an executable.
Possible Solution
Current work around is to remove the alias so I can continue to run the script.
❯ Remove-Alias exec
Or add this line to your Profile script
Steps to Reproduce (for bugs)
Install Powershell 7.3.0
Install psake powershell module (4.9.0)
Create a psakefile.ps1 with an Exec statement in it
Run the Invoke-PSake against the task with the Exec statement
Context
I was attempting to use my psakefile to handle some automation steps. After the error was thrown I had though there was an issue with my psakefile (typo, etc) and so I opened it up into VSCode where I discovered that it was reporting Exec as an alias for Switch-Process (I found this online documentation). I may also have to open an issue with PSScriptAnalyzer or VSCode-PowerShell as the analyzer reports it as an alias instead of a function and the formatting tool wants to replace it as such.
So with some additional troubleshooting, I am unable to reproduce this in PowerShell 7.2.* and with a bit of digging I found a PR on the main PowerShell repo for PowerShell 7.3.1, which looks to create a colliding function instead of an alias.
I have been unable to reproduce in Windows, as the alias Exec and function Switch-Process don't exist there.
Your Environment
Module version used:
❯ Get-Module psake
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 4.9.0 psake {Assert, Exec, FormatTaskName, Framework…}
Operating System and PowerShell version:
❯ $PSVersionTable
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Linux 6.0.6-76060006-generic #202210290932~1669062050~22.04~d94609a SMP PREEMPT_DYNAMIC Mon N
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The text was updated successfully, but these errors were encountered:
While doing Powershell development on Linux I encountered an issue running a
psakefile.ps1
.The component:
Expected Behavior
Current Behavior
Possible Solution
Current work around is to remove the alias so I can continue to run the script.
Or add this line to your Profile script
Steps to Reproduce (for bugs)
Exec
statement in itInvoke-PSake
against the task with theExec
statementContext
I was attempting to use my psakefile to handle some automation steps. After the error was thrown I had though there was an issue with my psakefile (typo, etc) and so I opened it up into VSCode where I discovered that it was reporting
Exec
as an alias forSwitch-Process
(I found this online documentation). I may also have to open an issue with PSScriptAnalyzer or VSCode-PowerShell as the analyzer reports it as an alias instead of a function and the formatting tool wants to replace it as such.So with some additional troubleshooting, I am unable to reproduce this in PowerShell 7.2.* and with a bit of digging I found a PR on the main PowerShell repo for PowerShell 7.3.1, which looks to create a colliding function instead of an alias.
I have been unable to reproduce in Windows, as the alias
Exec
and functionSwitch-Process
don't exist there.Your Environment
The text was updated successfully, but these errors were encountered: