aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

Read-S3Object commands continues downloading after pressing CTRL + C to terminate it #190

Open pcgeek86 opened 3 years ago

pcgeek86 commented 3 years ago

Description

When you run the Read-S3Object command and press CTRL + C to cancel the download, the download continues in the background instead of canceling.

Reproduction Steps

  1. Run Read-S3Object on a large file
  2. Press CTRL + C to cancel download
  3. Observe: You cannot delete the destination file
  4. Observe: Your network connection remains active according to Task Manager, or other OS metrics

Untitled Project

Logs

Environment

[cbt]C:\Users\TrevorSullivan> { $PSVersionTable; gmo }.Invoke() | clip
Name                           Value
----                           -----
PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Microsoft Windows 10.0.21301
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name              : AWS.Tools.Common
Path              : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.Common\4.1.7.0\AWS.Tools.Common.dll
Description       : The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment. In order to manage each AWS service, install the corresponding module (e.g. AWS.Tools.EC2, AWS.Tools.S3...).
                    The module AWS.Tools.Installer (https://www.powershellgallery.com/packages/AWS.Tools.Installer/) makes it easier to install, update and uninstall the AWS.Tools modules.
                    This version of AWS Tools for PowerShell is compatible with Windows PowerShell 5.1+ and PowerShell Core 6+ on Windows, Linux and macOS. When running on Windows PowerShell, .NET Framework 4.7.2 or newer is required.
                    Alternative modules, AWSPowerShell.NetCore and AWSPowerShell, provide support for all AWS services from a single module and also support older versions of Windows PowerShell and .NET Framework.
Guid              : e5b05bf3-9eee-47b2-81f2-41ddc0501b86
Version           : 4.1.7.0
ModuleBase        : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.Common\4.1.7.0
ModuleType        : Binary
PrivateData       : {PSData}
AccessMode        : ReadWrite
ExportedAliases   : {[Clear-AWSCredentials, Clear-AWSCredentials], [Clear-AWSDefaults, Clear-AWSDefaults], [Get-AWSCredentials, Get-AWSCredentials], [Initialize-AWSDefaults, Initialize-AWSDefaults]…}
ExportedCmdlets   : {[Add-AWSLoggingListener, Add-AWSLoggingListener], [Clear-AWSCredential, Clear-AWSCredential], [Clear-AWSDefaultConfiguration, Clear-AWSDefaultConfiguration], [Clear-AWSHistory, Clear-AWSHistory]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {AWS.Tools.Common.Completers, AWS.Tools.Common.Aliases}

Name              : AWS.Tools.S3
Path              : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.S3\4.1.7.0\AWS.Tools.S3.dll
Description       : The S3 module of AWS Tools for PowerShell lets developers and administrators manage Amazon Simple Storage Service (S3) from the PowerShell scripting environment. In order to manage each AWS service, install the corresponding module (e.g. AWS.Tools.EC2, AWS.Tools.S3...).
                    The module AWS.Tools.Installer (https://www.powershellgallery.com/packages/AWS.Tools.Installer/) makes it easier to install, update and uninstall the AWS.Tools modules.
                    This version of AWS Tools for PowerShell is compatible with Windows PowerShell 5.1+ and PowerShell Core 6+ on Windows, Linux and macOS. When running on Windows PowerShell, .NET Framework 4.7.2 or newer is required. Alternative modules AWSPowerShell.NetCore and AWSPowerShell, provide support for all AWS services from a single module and also support older versions of Windows PowerShell and .NET Framework.
Guid              : b4e504bd-3d14-4563-918a-91025140eba4
Version           : 4.1.7.0
ModuleBase        : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.S3\4.1.7.0
ModuleType        : Binary
PrivateData       : {PSData}
AccessMode        : ReadWrite
ExportedAliases   : {[Remove-S3MultipartUploads, Remove-S3MultipartUploads]}
ExportedCmdlets   : {[Add-S3PublicAccessBlock, Add-S3PublicAccessBlock], [Copy-S3Object, Copy-S3Object], [Get-S3ACL, Get-S3ACL], [Get-S3Bucket, Get-S3Bucket]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {AWS.Tools.S3.Completers, AWS.Tools.S3.Aliases}

Name              : AzureExt
Path              : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AzureExt\1.1.84\AzureExt.psm1
Description       : This PowerShell module provides extensions on top of the core Microsoft Azure Service Management (ASM) and Azure Resource Manager (ARM) PowerShell modules.
                        The goal of this module is to provide command aliases, built-in help documentation, auto-completion functions, and helper functions that make the Microsoft Azure platform easier to use.

                        Please send feedback about your experience to the project author: Trevor Sullivan <trevor@trevorsullivan.net>. Bugs and feature requests can also be filed on the GitHub issue tracker.
Guid              : bd4390dc-a8ad-4bce-8d69-f53ccf8e4163
Version           : 1.1.84
ModuleBase        : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AzureExt\1.1.84
ModuleType        : Script
PrivateData       : {PSData}
AccessMode        : ReadWrite
ExportedAliases   : {[azrdp, azrdp], [azrmrdp, azrmrdp], [clazpr, clazpr], [gazrg, gazrg]…}
ExportedCmdlets   : {}
ExportedFunctions : {[Invoke-AzureRemoteDesktop, Invoke-AzureRemoteDesktop], [Invoke-AzureRmRemoteDesktop, Invoke-AzureRmRemoteDesktop], [Publish-AzureStorageBlob, Publish-AzureStorageBlob], [Remove-AzureRmResourceGroupGui, Remove-AzureRmResourceGroupGui]…}
ExportedVariables : {}
NestedModules     : {}

Name              : ImportGuard
Path              : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.Common\4.1.7.0\ImportGuard.ps1
Description       : 
Guid              : 00000000-0000-0000-0000-000000000000
Version           : 0.0
ModuleBase        : C:\Users\TrevorSullivan\Documents\PowerShell\Modules\AWS.Tools.Common\4.1.7.0
ModuleType        : Script
PrivateData       : 
AccessMode        : ReadWrite
ExportedAliases   : {}
ExportedCmdlets   : {}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {}

Name              : Microsoft.PowerShell.Management
Path              : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1
Description       : 
Guid              : eefcb906-b326-4e99-9f54-8b4bb6ef3c6d
Version           : 7.0.0.0
ModuleBase        : C:\Users\TrevorSullivan\scoop\apps\pwsh\current
ModuleType        : Manifest
PrivateData       : 
AccessMode        : ReadWrite
ExportedAliases   : {[gcb, gcb], [gin, gin], [gtz, gtz], [scb, scb]…}
ExportedCmdlets   : {[Add-Content, Add-Content], [Clear-Content, Clear-Content], [Clear-Item, Clear-Item], [Clear-ItemProperty, Clear-ItemProperty]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {Microsoft.PowerShell.Commands.Management}

Name              : Microsoft.PowerShell.Security
Path              : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\Microsoft.PowerShell.Security\Microsoft.PowerShell.Security.psd1
Description       : 
Guid              : a94c8c7e-9810-47c0-b8af-65089c13a35a
Version           : 7.0.0.0
ModuleBase        : C:\Users\TrevorSullivan\scoop\apps\pwsh\current
ModuleType        : Manifest
PrivateData       : 
AccessMode        : ReadWrite
ExportedAliases   : {}
ExportedCmdlets   : {[ConvertFrom-SecureString, ConvertFrom-SecureString], [ConvertTo-SecureString, ConvertTo-SecureString], [Get-Acl, Get-Acl], [Get-AuthenticodeSignature, Get-AuthenticodeSignature]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {Microsoft.PowerShell.Security}

Name              : Microsoft.PowerShell.Utility
Path              : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1
Description       : 
Guid              : 1da87e53-152b-403e-98dc-74d7b4d63d59
Version           : 7.0.0.0
ModuleBase        : C:\Users\TrevorSullivan\scoop\apps\pwsh\current
ModuleType        : Manifest
PrivateData       : {PSData}
AccessMode        : ReadWrite
ExportedAliases   : {[fhx, fhx]}
ExportedCmdlets   : {[Add-Member, Add-Member], [Add-Type, Add-Type], [Clear-Variable, Clear-Variable], [Compare-Object, Compare-Object]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {Microsoft.PowerShell.Commands.Utility}

Name              : Microsoft.WSMan.Management
Path              : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\Microsoft.WSMan.Management\Microsoft.WSMan.Management.psd1
Description       : 
Guid              : 766204a6-330e-4263-a7ab-46c87afc366c
Version           : 7.0.0.0
ModuleBase        : C:\Users\TrevorSullivan\scoop\apps\pwsh\current
ModuleType        : Manifest
PrivateData       : 
AccessMode        : ReadWrite
ExportedAliases   : {}
ExportedCmdlets   : {[Connect-WSMan, Connect-WSMan], [Disable-WSManCredSSP, Disable-WSManCredSSP], [Disconnect-WSMan, Disconnect-WSMan], [Enable-WSManCredSSP, Enable-WSManCredSSP]…}
ExportedFunctions : {}
ExportedVariables : {}
NestedModules     : {Microsoft.WSMan.Management}

Name              : PSReadLine
Path              : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\PSReadLine\PSReadLine.psm1
Description       : Great command line editing in the PowerShell console host
Guid              : 5714753b-2afd-4492-a5fd-01d9e2cff8b5
Version           : 2.1.0
ModuleBase        : C:\users\trevorsullivan\scoop\apps\pwsh\current\Modules\PSReadLine
ModuleType        : Script
PrivateData       : 
AccessMode        : ReadWrite
ExportedAliases   : {}
ExportedCmdlets   : {[Get-PSReadLineKeyHandler, Get-PSReadLineKeyHandler], [Get-PSReadLineOption, Get-PSReadLineOption], [Remove-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler], [Set-PSReadLineKeyHandler, Set-PSReadLineKeyHandler]…}
ExportedFunctions : {[PSConsoleHostReadLine, PSConsoleHostReadLine]}
ExportedVariables : {}
NestedModules     : {Microsoft.PowerShell.PSReadLine2}

Resolution


This is a :bug: bug-report

ashishdhingra commented 3 years ago

Hi @pcgeek86,

At high level it appears that cancelling S3 file download is not working. Just to have complete information here, is the downloaded file is complete and opens successfully?

Thanks, Ashish

pcgeek86 commented 3 years ago

If you let a file complete downloading, yes it works fine. I need to be able to cancel a download though, by hitting CTRL + C

github-actions[bot] commented 2 years ago

We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

ashishdhingra commented 2 years ago

No auto-close.

arthurcazevedo commented 2 years ago

Hi

closing or killing the powershell session were you started the cmdlet Read-S3Object also ends the download and release the file lock.