简体   繁体   中英

Random returns with some ADB command (Pull/Push)

I'm facing some problems with adb commands pull/push.

Sometimes, the command work well, I launch it, I get the percent and the result at the end:). Like this:

在此处输入图像描述 在此处输入图像描述

But sometimes the command doesn't return anything until it's finished. So instead of getting the progress I get nothing but an empty line:/

在此处输入图像描述

And the result at the end

在此处输入图像描述

Of course, both behaviors are obtained with exactly the same environment. Same device, same powershell window, same cable... But with an interval of 5 minutes...

I tried to reproduce the behavior many times, by changing the usb connection type of the device, killing and restarting the adb server, unplugging and replugging the device, changing adb server port, checking TCP connexion, use another command line tool... But I never found anything tangible

My final goal is to have a software that launches the pull/push and displays the progress during the process. Everything works fine, but obviously only when the adb command returns the right things

Is there some options that I'm missing? Can I force the behavior?

I'm using ADB version 31.0.3 and differents Android phone (Samsung/Huawei and Oppo)

This is interesting, For me, it's seems like the command you are executing should run as a background job eg - a task that may execute for a while and you wish to run in the background in order to avoid it to block your current session

Following this answer which direct us to the official documentation , it seems we need to do something like this:

$job = Start-Job adb pull -a "some_video-file.mp4"
Wait-Job $job
Receive-Job $job

It should wait until the job is completed (regardless to the overall files size, which in our case - impacts how long the operation will take) and only then return the output (signaling that the upload process is completed)

The only question remains - will it work? Please try this and share your findings with us. tnx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM