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

hotfix: read unexpected EOF error message in logs #966

Merged
merged 4 commits into from
Oct 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions detox/src/devices/android/ADB.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ADB {

async isBootComplete(deviceId) {
try {
const bootComplete = await this.shell(deviceId, `getprop dev.bootcomplete`);
const bootComplete = await this.shell(deviceId, `getprop dev.bootcomplete`, { silent: true });
return (bootComplete === '1');
} catch (ex) {
return false;
Expand Down Expand Up @@ -201,7 +201,7 @@ class ADB {
* @returns ChildProcessPromise
*/
logcat(deviceId, { file, pid, time }) {
let shellCommand = 'logcat -v brief';
let shellCommand = 'logcat';

// HACK: cannot make this function async, otherwise ChildProcessPromise.childProcess field will get lost,
// and this will break interruptProcess() call for any logcat promise.
Expand All @@ -210,13 +210,23 @@ class ADB {
shellCommand += ` -T "${time}"`;
}

if (pid > 0) {
const __pid = String(pid).padStart(5);
shellCommand += ` | grep "(${__pid}):"`;
}
if (apiLevel < 24) {
if (pid > 0) {
const __pid = String(pid).padStart(5);
shellCommand += ` -v brief | grep "(${__pid}):"`;
}

if (file) {
shellCommand += ` >> ${file}`;
}
} else {
if (pid > 0) {
shellCommand += ` --pid=${pid}`;
}

if (file) {
shellCommand += ` >> ${file}`;
if (file) {
shellCommand += ` -f ${file}`;
}
}

return this.spawn(deviceId, ['shell', shellCommand]);
Expand Down