Search code examples
windowsvb.netgoogle-cloud-storagegsutilgoogle-cloud-sdk

GCP SDK gsutil rsynch not returning progress


When I run gsutil rsynch from the GCP Console, or a .bat file, the full progress data does not display (it used to I'm pretty sure.) I'm on vers 403.0.0

Here is the command:

>gsutil rsync -r -n \\xxxx\WEBSITE\xxx\pages gs://xxx/pages
 Building synchronization state...
 Starting synchronization...

>

If I run the same command, followed by a pause in a .bat file, the pause is not hit - the batch file terminates. glist (maybe others) do output their data to the console and continue on to the balance of the batch commands.

c:
cd "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\"
gsutil rsync -r -d \\xxx\pages gs://xxx/pages 
pause <<<<< never get here

If I use .Net Process I can capture the Standard Out which does contained the progress data. However StdOut seems to close well after rsynch has finished.

Is this a bug? Or am I missing something?


Solution

  • I recommend that you update to the latest gsutil release. I tested on my machine and also on the Cloud Shell, both with the rsync version 4.31 and they display the progress of the command, listing the files being copied.

    I reproduced the script on different environments and observed that the script skips the commands after the rsync complete only on Windows machines. I tested on Google Cloud SDK Shell and also on Cygwin for Windows.

    However, on a Linux machine and also on Cloud Shell, the same script works as expected and it executes the subsequent commands after the rsync completes.

    This behavior depends on the implementation of individual shells. You will need to catch the unexpected behavior and handle the situation in the desired way, as the solution differs depending on the environment.