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

KeyboardInterrupt (ctrl+c) are sometimes ignored #1089

Closed
fviard opened this issue Apr 9, 2020 · 0 comments
Closed

KeyboardInterrupt (ctrl+c) are sometimes ignored #1089

fviard opened this issue Apr 9, 2020 · 0 comments
Assignees
Milestone

Comments

@fviard
Copy link
Contributor

fviard commented Apr 9, 2020

In some parts of the code, too generic try:except: are used.
And so, sometimes, s3cmd will not exit despite the user trying to interrupt it with multiple ctrl+c.

For example, it will be the case during long loops of remote copy of the same file.
Example

remote copy: 'zzz1.txt' -> 'zzz478.txt'
remote copy: 'zzz1.txt' -> 'zzz479.txt'
remote copy: 'zzz1.txt' -> 'zzz48.txt'
remote copy: 'zzz1.txt' -> 'zzz480.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz481.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz482.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz483.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz484.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz485.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz486.txt'
^CWARNING: Unable to remote copy files 's3://halohalo/myuser/zzz1.txt' -> 's3://halohalo/myuser/zzz487.txt'
remote copy: 'zzz1.txt' -> 'zzz488.txt'
remote copy: 'zzz1.txt' -> 'zzz489.txt'
remote copy: 'zzz1.txt' -> 'zzz49.txt'

The issue is code like that:

try:
   [...]
except:
   print("a message")
   pass/continue

SystemExit and KeyboardInterrupt are the only exceptions that do not inherit from Exception, but are still catched by the absolute catch-all except:

@fviard fviard added this to the 2.2.0 milestone Apr 9, 2020
@fviard fviard self-assigned this Apr 9, 2020
@fviard fviard closed this as completed in 99c2a7c Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant