Skip to content

Add android adb command #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 2, 2021
Merged

Add android adb command #782

merged 6 commits into from
Dec 2, 2021

Conversation

premun
Copy link
Member

@premun premun commented Dec 1, 2021

Resolves #726

Copy link
Contributor

@lpatalas lpatalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few notes/questions but overall it looks good.


try
{
var result = runner.RunAdbCommand(string.Join(" ", PassThroughArguments), Arguments.Timeout);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it handle white space in the arguments correctly? For example if I call xharness adb -- "some arg with spaces" it should pass it as a single argument.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I blindly trusted the existing Android code but now I verified it and we were not doing this so I added quotation from Apple side (we unfortunately have different process managers 😥 for some reason)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the most correct way to handle this would be to keep the arguments as an array and use ProcessStartInfo.ArgumentList instead of Arguments. It's more errorproof than making sure that everything is quoted correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, I was too fast and didn't even think for a second arguments is a string 😅

I see the failures in tests now:

Executing command: 'adb.exe  "devices -l"'

Copy link
Member Author

@premun premun Dec 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the most correct way would be to switch to a single implementation in this repo which would be the one coming from Xamarin that already does all this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpatalas I switched AdbRunner to accept an array of arguments instead. It uncovered many places where the code wasn't escaping potential problems in paths and other places.

@premun premun merged commit b2b296f into dotnet:main Dec 2, 2021
@premun premun deleted the prvysoky/adb-command branch December 2, 2021 13:41
premun added a commit to dotnet/arcade that referenced this pull request Dec 9, 2021
In dotnet/xharness#782 we introduced a the android adb command and removed android state --adb so we now need to use that to call ADB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create android adb command
2 participants