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

Return Errorlevel when Fixing Clashes #720

yottabit42 opened this Issue Sep 5, 2016 · 2 comments


None yet
2 participants
Copy link

commented Sep 5, 2016

When -fix-clashes is used and the client does fix clashes, it exits with an Errorlevel of 0. It would be very nice if it could exit with a higher Errorlevel in this case so I can run it in a loop for a pull operation, where it will keep running the pull, fixing clashes on each run necessary, until the pull has actually completed.

Here is an example script I have in mind for this use-case. Unfortunately this script doesn't work at this time because the drive client returns Errorlevel 0 after fixing clashes.

# Pull Google Photos via cron with odeke-em/drive client
# Revision 160905b-yottabit

# Test case for setting errorlevel variable E; expect output to be 1, 0
#! true
#echo $E
#echo $?

# Init the errorlevel variable

# Init the loop counter

# Run drive pull operation in a loop
# -no-prompt will accept -fix-clashes operation non-interactively
# -fix-clashes will fix clashes and then exit, so loop until pull operation finishes successfully
while [ $E -ne 0 ]; do
  cd ~/gdrive
  time drive pull -fix-clashes -no-prompt -verbose "Google Photos"
  echo Errorlevel: $E
  echo Passes complete: $L

This comment has been minimized.

Copy link

commented Sep 8, 2016

Thank you @yottabit42 for reporting this issue and my apologies for the late reply. Also welcome to drive.

A hero @sselph has fixed this issue with PR #722. Please get the latest from master.


This comment has been minimized.

Copy link

commented Sep 9, 2016

Worked perfect! Thanks, guys!!

$ ./ 
Testing errorlevels; expect output to be 1, 0:

Renaming "/Google Photos/2013/09/IMG_0095-COLLAGE.jpg" "1xQ9INxWXUiO0jOA6TfTmjEW97a2M7UHcDg" -> "IMG_0095-COLLAGE_0.jpg"
Clashes were fixed, please retry the operation 

real    6m59.778s
user    0m19.719s
sys     0m7.581s

Errorlevel: 24
Passes complete: 1

+ /Google Photos/2016/09/IMG_20160908_073851.jpg
+ /Google Photos/2016/09/IMG_20160907_180217.jpg
+ /Google Photos/2016/09/IMG_20160907_180209.jpg
+ /Google Photos/2016/09/IMG_20160907_180155.jpg
+ /Google Photos/2016/09/IMG_20160907_174126.jpg
+ /Google Photos/2016/09/IMG_20160907_174111.jpg
+ /Google Photos/2016/09/IMG_20160907_174104.jpg
+ /Google Photos/2016/09/IMG_20160907_162012.jpg
+ /Google Photos/2016/09/IMG_20160907_162017.jpg
+ /Google Photos/2016/09/IMG_20160907_161502_1.jpg
+ /Google Photos/2016/09/IMG_20160907_161502.jpg
+ /Google Photos/2016/09/IMG_20160907_161501.jpg
+ /Google Photos/2016/09/IMG_20160907_161456.jpg
+ /Google Photos/2016/09/775884700192799705?account_id=1
+ /Google Photos/2013/09/IMG_0095-COLLAGE_0.jpg
+ /Google Photos/2013/09/IMG_0015-COLLAGE.jpg
- /Google Photos/2013/09/9%2F8%2F13 - 1_0
Addition count 16 src: 39.50MB
Deletion count 1 dest: 27.29KB
 41442673 / 41414724 [================================================================================================================================================================================] 100.07% 4s

real    7m8.054s
user    0m20.557s
sys     0m8.632s

Errorlevel: 0
Passes complete: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.