Skip to content
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

add try/catch to avoid error by pullApk in pushString #430

Merged

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Sep 24, 2018

Fix appium/appium#11403 (comment)

According to appium/appium#11403 (comment) , adb.pullApk can raise an error.

In this PR, I've added try/catch to ignore the error if adb.pullApk raises an error. The app keeps empty in the case.

I ensured this change fix the issue: appium/appium#11403 (comment)


related commit is 187c669#diff-97eeab6ebf462ba97a11ee0221ddaf13R509

@@ -506,7 +506,12 @@ helpers.pushStrings = async function (language, adb, opts) {
// clean up remote string.json if present
await adb.rimraf(remoteFile);

const app = opts.app || await adb.pullApk(opts.appPackage, opts.tmpDir);
let app = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

do not assign app to any value by default

Copy link
Member Author

Choose a reason for hiding this comment

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

try {
app = opts.app || await adb.pullApk(opts.appPackage, opts.tmpDir);
} catch (err) {
logger.debug(`Failed to pull an apk from '${opts.appPackage}' to '${opts.tmpDir}'. Original error: ${err.message}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather change the level to info

@KazuCocoa
Copy link
Member Author

@imurchie Could you take a look at this?

@KazuCocoa KazuCocoa merged commit 156c6e4 into appium:master Sep 25, 2018
@KazuCocoa
Copy link
Member Author

@dpgraham Can you publish incrementing the version when you have time?

@KazuCocoa KazuCocoa deleted the catch-an-error-of-pullapk-in-pushstring branch September 29, 2018 14:37
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.

Apk doesn't start on specific device
3 participants