DeviceFarmer / adbkit

A pure Node.js client for the Android Debug Bridge.
Other
234 stars 53 forks source link

Supporting adb shell with v2 protocol #470

Open dfriederich opened 1 year ago

dfriederich commented 1 year ago

When using adb shell currently, adb-kit shell is not using the v2 protocol. This causes that when a command fails on the device, adb-kit is not aware of this, and hence is not reporting an error. In addition we don't have stdout/stderr separation, and while supporting stdin I did not see a way to end a stdin stream while also keeping the output alive. All those things can be acomplished with using the v2 protocol, which is used when a service request is not using just 'shell:cmd", but instead 'shell,v2:cmd'.

I did implement this support atop of adb-kit, by basically following the adb shell implementation, just extending it a bit to be also able to send the ,v2 part along, and then to split the returned Duplex into stdout/stderr/stdin and the exit code. I can prepare a CR if there is a good chance of that it would be included in a future build :-). Just let me know.

Thanks

denis99999 commented 1 year ago

@dfriederich you have to ensure there is no regression issue in particular on STF!