Closed PlagueHO closed 6 years ago
There doesn't seem to be a clear pattern for getting the temp folder location in different platforms: https://github.com/PowerShell/PowerShell/issues/4216
So it might just be simplest to add a Get-TempPath
utility function that just returns:
@RamblingCookieMonster - are you happy for me to submit a PR to fix this by adding a new Get-TempFolder
utility function in the /Private/PSYaml/Private/
folder?
Eek, sorry, forgot about this!
Sure! I could see that function being useful for other bits.
If it's easier, you could also do something like
if (-not
$ShadowPath`) bit that sets the default if not specified, and only in the Windows section of that logicEither works for me!
Cool! In progress now - thanks @RamblingCookieMonster !
@RamblingCookieMonster - I've been looking at this one closely and there is one thing I find strange: The 'Windows only' code (the New-Item
line) seems to fire under Linux and macOS on TravisCI
and Azure Pipelines
? It looks like it shouldn't execute in those environments.
It seems that this test evaluates to true
:
if(!(Test-Path -Path Variable:\IsWindows) -or $IsWindows) {
}
I've done a bunch of tests on my local Ubuntu server and on the TravisCI to confirm the result of the above test: https://travis-ci.org/PlagueHO/CosmosDB/jobs/431726377#L2803
What it shows is that the above test should not
have evaluated to True on TravisCI so this code shouldn't have executed but for some reason it does (https://travis-ci.org/PlagueHO/CosmosDB/jobs/431726377#L2808)?
Completely stumped as to why this code executes...
Any idea why?
Weird!! I... might just poke around and see if powershell-yaml is compatible, for some reason didn't use it at the start - works cross platform, haven't had any issues in other modules
It is really odd indeed. It doesn't actually stop the module from working BTW - at least not for me. It just logs the exception.
I get an error when this line https://github.com/RamblingCookieMonster/PSDeploy/blob/90ec3397d7900e3400c95315f4d430db79e2547d/PSDeploy/Private/PSYaml/Private/Shadow-Copy.ps1#L1
runs on Linux (and OSx) E.g. see Travis CI https://travis-ci.org/PlagueHO/CosmosDB/jobs/423782302#L519
$env:temp
is not declared in Linux and OSx.I'll take a deeper look over the next few days and see if I can suggest a fix and submit a PR to you.