-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Invoke-SqlCmd broken if Set-Location used in Tasks (2.11.x) #1455
Comments
I was reviewing the documentation here: Manage SQL Server on Linux with PowerShell Core. It seems that |
Based on what I've read it does something like |
Before, what version of Powershell you were using ? |
7.3.12, but it appears to occur regardless of what PS version I test with. |
In 2.10.x the errors wouldn't be present, as Tasks in 2.11.z we're updated so that any errors thrown from a task were actually logged - otherwise they were just being silently hidden. Though, the only changes should just be around logging, so I can't immediately think why 2.10.x would work but 2.11.x wouldn't work 🤔 If you set the location back to the original at the end of each Task, does that then resolve the issue? Because might just be that at the start of a task (or even a Schedule/etc.) they just need to ensure the location is reset. |
@Badgerati From my initial testing yes - if I set the location back in the 1st task before it returns then other tasks etc. continue to work as expected. This specific code has been essentially as-is for 3-4 years now 😄 |
Describe the Bug
If
Set-Location
is used within a task and then not set back to the original location before returning future usage ofInvoke-SqlCmd
in other tasks generates exceptions and causes them to end prematurely.Steps To Reproduce
Set-Location
.Invoke-SqlCmd
calls.Invoke-PodeTask -Name 'test_task1' -Wait
,Invoke-PodeTask -Name 'test_task2' -Wait
etcTask1 should run all the way to completion, even with
Set-Location
being used and evenInvoke-SqlCmd
usage if added.Task2 should launch fine and run everything up to the first instance of
Invoke-SqlCmd
. Oddly the first use will actually work (i.e. SQL Insert actually inserts) but throws an exception. Anything else afterwards is not ran.Task3 should have the same behavior as Task2.
Exception
Expected Behavior
Before 2.11.x no exception occurs and everything continues running normally. A workaround appears to be running this in Task1 before it returns. I haven't tested this thoroughly though, and nothing else changed besides the version of Pode though I did try 2.11.0 and also PS7.4.6. Push/Pop-Location may also work.
Platform
The text was updated successfully, but these errors were encountered: