Skip to content

Commit e51d2b0

Browse files
author
Max Brunsfeld
authored
Merge pull request atom#16456 from atom/revert-15081-multiple-instances
Revert "Independent Atom instances (per $ATOM_HOME)"
2 parents e3b0c8c + 798bbe3 commit e51d2b0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/main-process/atom-application.coffee

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ FileRecoveryService = require './file-recovery-service'
88
ipcHelpers = require '../ipc-helpers'
99
{BrowserWindow, Menu, app, dialog, ipcMain, shell, screen} = require 'electron'
1010
{CompositeDisposable, Disposable} = require 'event-kit'
11-
crypto = require 'crypto'
1211
fs = require 'fs-plus'
1312
path = require 'path'
1413
os = require 'os'
@@ -34,16 +33,11 @@ class AtomApplication
3433
# Public: The entry point into the Atom application.
3534
@open: (options) ->
3635
unless options.socketPath?
37-
username = if process.platform is 'win32' then process.env.USERNAME else process.env.USER
38-
# Lowercasing the ATOM_HOME to make sure that we don't get multiple sockets
39-
# on case-insensitive filesystems due to arbitrary case differences in paths.
40-
atomHomeUnique = path.resolve(process.env.ATOM_HOME).toLowerCase()
41-
hash = crypto.createHash('sha1').update(username).update('|').update(atomHomeUnique)
42-
atomInstanceDigest = hash.digest('hex').substring(0, 32)
4336
if process.platform is 'win32'
44-
options.socketPath = "\\\\.\\pipe\\atom-#{options.version}-#{process.arch}-#{atomInstanceDigest}-sock"
37+
userNameSafe = new Buffer(process.env.USERNAME).toString('base64')
38+
options.socketPath = "\\\\.\\pipe\\atom-#{options.version}-#{userNameSafe}-#{process.arch}-sock"
4539
else
46-
options.socketPath = path.join(os.tmpdir(), "atom-#{options.version}-#{process.arch}-#{atomInstanceDigest}.sock")
40+
options.socketPath = path.join(os.tmpdir(), "atom-#{options.version}-#{process.env.USER}.sock")
4741

4842
# FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely
4943
# take a few seconds to trigger 'error' event, it could be a bug of node

0 commit comments

Comments
 (0)