Open ropery opened 5 years ago
Interesting issue.
This is probably because adb-sync calls "adb shell", which in turn connects stdin to the phone.
I think I can fix this by making adb-sync not connect stdin to its subprocesses anymore.
I face a similar problem : the directories I want to sync are listed in a CSV file 'file.csv' (2 fields on each line : SOURCE,DEST).
When I run the bash script
while read line; do ./adb-sync $SOURCE $DEST done < file.csv
only the first line of file.csv is read and consequently, only the first directory is synced.
I've found a workaround. Instead of a 'while... do... done' loop, I use a 'for... do... done' loop.
for line in $(cat file.csv); do ./adb-sync $SOURCE $DEST done
It works fine, but I couldn't explain why !
Pretty sure it is not adb-sync but adb that eats standard input, so I suggest filing a bug against adb. We could work around it in adb-sync but it would probably be preferred to fix adb.
Having said that, as a workaround you can also use
adb-sync ... </dev/null
in your scripts.
On Sun, Jul 18, 2021, 05:23 Jarival @.***> wrote:
I face a similar problem : the directories I want to sync are listed in a CSV file 'file.csv' (2 fields on each line : SOURCE,DEST).
When I run the bash script
!/bin/bash
while read line; do ./adb-sync $SOURCE $DEST done < file.csv
only the first line of file.csv is read and consequently, only the first directory is synced.
I've found a workaround. Instead of a 'while... do... done' loop, I use a 'for... do... done' loop.
!/bin/bash
for line in $(cat file.csv); do ./adb-sync $SOURCE $DEST done
It works fine, but I couldn't explain why !
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/google/adb-sync/issues/38#issuecomment-882027535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5NMF6XBEROXSTYTCPEZ3TYKMRLANCNFSM4G44LTUA .
foo
(containing file1.txt
) andbar
(containing file2.txt
) are two directories under/sdcard
on my phone.When I run the following script
test.sh
on my computer:The result is that only the first directory
foo
is synced:The problem is
read -r dir
fails in the second iteration, perhaps implying stdin in closed.