Skip to content
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

Compress-Archive doesn't respect SupportsShouldProcess=$true when called from advanced function #35

Closed
shew00 opened this issue Mar 30, 2017 · 1 comment · Fixed by #131
Assignees

Comments

@shew00
Copy link

shew00 commented Mar 30, 2017

Steps to reproduce

function TestCompress() {
    [CmdLetBinding(SupportsShouldProcess=$true)]
    param (
        [string]$source,
        [string]$dest
    )
    PROCESS {
        Compress-Archive -Path $source -DestinationPath $dest
    }
 }

Call with TestCompress -source testfile -dest $env:temp\testfile.zip -WhatIf

Expected behavior

Output should be:

What if: Performing the operation "Compress-Archive" on target ...\testfile.zip
No zip file archive should be created.

Actual behavior

Zip file archive is created in destination directory.

Notes

The -WhatIf parameter is passed through if Compress-Archive is replaced by Copy-Item in the function above.

Calling Compress-Archive with -WhatIf directly yields the correct results.

@ayousuf23
Copy link
Contributor

This is fixed.

@ayousuf23 ayousuf23 self-assigned this Aug 18, 2022
@ayousuf23 ayousuf23 linked a pull request Aug 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants