Shorten Socket path for makeSingleInstance in sandboxed apps #7566

merged 3 commits into from Oct 17, 2016


None yet

2 participants


This PR amends #5236 to work with apps that are sandboxed, non-MAS applications, by detecting dynamically whether we should apply the sandbox workaround instead of restricting it to the MAS build

paulcbetts added some commits Oct 11, 2016
@paulcbetts paulcbetts Add a method to determine whether we're in the Apple sandbox e84ae6e
@paulcbetts paulcbetts Instead of gating the path shortening to MAS_BUILD, figure it out at …
@paulcbetts paulcbetts Fix oops typos

Verified that this works inside a sandboxed app (which is to say, it doesn't crash)

@@ -348,6 +348,21 @@ bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) {
return (cookie == ReadLink(path));
+bool IsAppSandboxed() {
+#if defined(OS_MACOSX)
+ // NB: There is no sane API for this, we have to just guess by
zcbenz Oct 12, 2016 Contributor

Maybe just #if defined(MAS_BUILD)?

paulcbetts Oct 12, 2016 edited Contributor

That's the whole problem, if you're sandboxed but not using the MAS build (i.e. because you want to sandbox your app but hand it to people via a Zip file), this ifdef is incorrect

zcbenz Oct 17, 2016 Contributor

That makes sense.

zcbenz commented Oct 17, 2016


@zcbenz zcbenz merged commit cbe9768 into master Oct 17, 2016

6 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
electron-mas-x64 Build #2603 succeeded in 9 min 7 sec
electron-osx-x64 Build #2610 succeeded in 9 min 39 sec
electron-win-ia32 Build #1699 succeeded in 8 min 5 sec
electron-win-x64 Build #1674 succeeded in 8 min 8 sec
@zcbenz zcbenz deleted the always-shorten-path branch Oct 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment