Skip to content

KeyboardInterrupt (ctrl+c) are sometimes ignored #1089

@fviard

Description

@fviard

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:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions