We have implemented an experimental backend for rclone (remote is a digital preservation system, not open source yet) - and we have an unusual requirement: For "Put" operations, we need to gather all files first, before we can start uploading them, because we need to register a set of files first with the remote.
To implement this, we resorted to an "atexit" handler - that is, we "collect all Put operations" (e.g. from a large directory) first and then at "atexit" time do the actual upload; this works fine so far - however I found that it's not possible to return or set an error in an "atexit" handler.
Is that on purpose?
I'd imagine that
atexit.Run could as well just return an error, e.g. here: rclone/cmd.go at c85fbebce6f7166350c79e11fae763c8264ef865 · rclone/rclone · GitHub?
In general, is there a better way to implement such kind of batch upload operations?