Skip to content

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

@tristanbarcelon

Description

@tristanbarcelon

Hi Peter Groenewegen (@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions