Skip to content

Commit

Permalink
If "activity not started" in result of startURI, throw error"
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham committed Mar 22, 2018
1 parent 7ec6fd2 commit 59da437
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/tools/apk-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ apkUtilsMethods.startUri = async function (uri, pkg) {
try {
let args = ["am", "start", "-W", "-a", "android.intent.action.VIEW", "-d",
uri.replace(/&/g, '\\&'), pkg];
await this.shell(args);
const res = await this.shell(args);

// Doesn't always return non-zero exit code when it fails
if (res.toLowerCase().includes('activity not started')) {
throw new Error(res);
}
} catch (e) {
log.errorAndThrow(`Error attempting to start URI. Original error: ${e}`);
}
Expand Down

0 comments on commit 59da437

Please sign in to comment.