pure-python-adb icon indicating copy to clipboard operation
pure-python-adb copied to clipboard

adb shell return value

Open Ragenvald opened this issue 6 years ago • 3 comments

Is there capability to get return value of command execution via 'adb shell' ?

Ragenvald avatar Dec 12 '19 04:12 Ragenvald

Hi Ragenvald

The return value of shell function is the command result

example

print(device.shell("echo hello world !"))
>> hello world !

Swind avatar Dec 20 '19 19:12 Swind

Hi Ragenvald

The return value of shell function is the command result

example

print(device.shell("echo hello world !"))
>> hello world !

thank you for your answer, but I'm looking for the numeric return value. For example, the return value of command which finished with error (ls /asdfasdfasdf)

Ragenvald avatar Feb 24 '20 08:02 Ragenvald

You could do

print(device.shell("echo hello world; echo $?"))

nickeldan avatar Aug 16 '22 15:08 nickeldan