XpiritBV / Vsts-Build-Task-InlinePowershell

6 stars 8 forks source link

Script files are not being cleaned up after each execution from temp directory #17

Open tristanbarcelon opened 5 years ago

tristanbarcelon commented 5 years ago

Hi @pgroene, we ran into the 65k file limitation of [System.IO.Path]::GetTempFileName() in our CD environment. As documented here, temporary files need to be pruned if GetTempFileName() is going to be used to generate file names.

To avoid the 65k file limitation issue, I'm proposing we replace [System.IO.Path]::GetTempFileName().Replace(".tmp",".ps1") with Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath "$([System.Guid]::NewGuid().Guid).ps1" and also deleting the ps1 file after invocation. If you're ok with this proposal, I can submit a PR. I cloned your repo here: https://github.com/tristanbarcelon/Vsts-Build-Task-InlinePowershell and it contains the proposed changes.

Thank you.

pgroene commented 5 years ago

If you create the PR, I'll review and probably accept it without any changes. The code change seems to make sense.

pgroene commented 5 years ago

Thank you for your PR, I'll update the code (and Marketplace extension) asap.

tristanbarcelon commented 5 years ago

Hi @pgroene . Thank you for accepting the PR. Will you be able to update the marketplace extension version with this fix? Right now I find it strange that our builds are failing with the same error and are using version 1.1.7 even though the latest version on marketplace is 1.1.10. I would have expected the build agent to automatically upgrade to 1.1.10 seamlessly from 1.1.7.