Skip to content

Commit 3e9577a

Browse files
authored
chmod +x crashpad_handler (#1774)
* chmod +x crashpad_handler * More chmod
1 parent b287219 commit 3e9577a

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

lib/PuppeteerSharp/BrowserFetcher.cs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ public async Task<RevisionInfo> DownloadAsync(string revision)
261261
var url = GetDownloadURL(Product, Platform, DownloadHost, revision);
262262
var filePath = Path.Combine(DownloadsFolder, url.Split('/').Last());
263263
var folderPath = GetFolderPath(revision);
264+
var archiveName = GetArchiveName(Product, Platform, revision);
264265

265266
if (new DirectoryInfo(folderPath).Exists)
266267
{
@@ -302,31 +303,38 @@ public async Task<RevisionInfo> DownloadAsync(string revision)
302303

303304
new FileInfo(filePath).Delete();
304305

305-
var revisionInfo = RevisionInfo(revision);
306-
307-
if (revisionInfo != null && GetCurrentPlatform() == Platform.Linux)
306+
if (GetCurrentPlatform() == Platform.Linux)
308307
{
309-
var execPath = revisionInfo.ExecutablePath;
310-
var dirName = Path.GetDirectoryName(execPath);
311-
312-
var code = LinuxSysCall.Chmod(execPath, LinuxSysCall.ExecutableFilePermissions);
313-
if (code != 0)
308+
var executables = new string[]
314309
{
315-
throw new Exception("Chmod operation failed");
316-
}
310+
"chrome",
311+
"chrome_sandbox", // setuid
312+
"crashpad_handler",
313+
"google-chrome",
314+
"nacl_helper",
315+
"nacl_helper_bootstrap",
316+
"xdg-mime",
317+
"xdg-settings",
318+
"cron/google-chrome",
319+
};
317320

318-
var naclPath = $"{dirName}/nacl_helper";
319-
if (File.Exists(naclPath))
321+
foreach (var executable in executables)
320322
{
321-
code = LinuxSysCall.Chmod(naclPath, LinuxSysCall.ExecutableFilePermissions);
322-
if (code != 0)
323+
var execPath = Path.Combine(folderPath, archiveName, executable);
324+
325+
if (File.Exists(execPath))
323326
{
324-
throw new Exception("Chmod operation failed");
327+
var code = LinuxSysCall.Chmod(execPath, LinuxSysCall.ExecutableFilePermissions);
328+
329+
if (code != 0)
330+
{
331+
throw new Exception("Chmod operation failed");
332+
}
325333
}
326334
}
327335
}
328336

329-
return revisionInfo;
337+
return RevisionInfo(revision);
330338
}
331339

332340
private Task InstallDMGAsync(string dmgPath, string folderPath)

0 commit comments

Comments
 (0)