fix(BrowserFetcher): ensure executable has proper permissions (#2342)

This patch ensures Chromium executable has permissions to be executed
by non-owner users.

Fixes #2283.
This commit is contained in:
Andrey Lushnikov
2018-04-10 14:11:59 -07:00
committed by GitHub
parent beea6f9c82
commit 5089d2ec2e
2 changed files with 8 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ const path = require('path');
const {helper} = require('../lib/helper');
const mkdtempAsync = helper.promisify(fs.mkdtemp);
const readFileAsync = helper.promisify(fs.readFile);
const statAsync = helper.promisify(fs.stat);
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
const utils = require('./utils');
@@ -51,6 +52,8 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
revisionInfo = await browserFetcher.download('123456');
expect(revisionInfo.local).toBe(true);
expect(await readFileAsync(revisionInfo.executablePath, 'utf8')).toBe('LINUX BINARY\n');
const expectedPermissions = os.platform() === 'win32' ? 0666 : 0755;
expect((await statAsync(revisionInfo.executablePath)).mode & 0777).toBe(expectedPermissions);
expect(await browserFetcher.localRevisions()).toEqual(['123456']);
await browserFetcher.remove('123456');
expect(await browserFetcher.localRevisions()).toEqual([]);