Skip to content

Commit

Permalink
fix(android): escape path to adb binary
Browse files Browse the repository at this point in the history
  • Loading branch information
forki authored and noomorph committed Nov 7, 2019
1 parent 0255f82 commit fdc169e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion detox/src/devices/android/ADB.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class ADB {

async adbCmd(deviceId, params, options) {
const serial = `${deviceId ? `-s ${deviceId}` : ''}`;
const cmd = `${this.adbBin} ${serial} ${params}`;
const cmd = `"${this.adbBin}" ${serial} ${params}`;
const retries = _.get(options, 'retries', 1);
_.unset(options, 'retries');

Expand Down
6 changes: 3 additions & 3 deletions detox/src/devices/android/ADB.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('ADB', () => {
describe('devices', () => {
it(`should invoke ADB`, async () => {
await adb.devices();
expect(exec).toHaveBeenCalledWith(`${adbBinPath} devices`, { verbosity: 'high' }, undefined, 1);
expect(exec).toHaveBeenCalledWith(`"${adbBinPath}" devices`, { verbosity: 'high' }, undefined, 1);
expect(exec).toHaveBeenCalledTimes(1);
});

Expand Down Expand Up @@ -137,11 +137,11 @@ describe('ADB', () => {
await adb.install('emulator-5556', 'path inside "quotes" to/app');

expect(exec).toHaveBeenCalledWith(
expect.stringContaining('adb -s emulator-5556 shell "getprop ro.build.version.sdk"'),
expect.stringContaining('adb" -s emulator-5556 shell "getprop ro.build.version.sdk"'),
{}, undefined, 5);

expect(exec).toHaveBeenCalledWith(
expect.stringContaining('adb -s emulator-5556 install -rg "path inside \\"quotes\\" to/app"'),
expect.stringContaining('adb" -s emulator-5556 install -rg "path inside \\"quotes\\" to/app"'),
undefined, undefined, 1);
});

Expand Down

0 comments on commit fdc169e

Please sign in to comment.