Atom silently dismisses some serious (though non-critical) startup errors #13326
Description
I had configured (via /etc/environment) the TMP var (which specifies the temporary directory on most GNU/Linux) to point to ~/.tmp, but as I already know, node-based apps don't recognize it (though other apps, like Thunderbird, do).
This dir is where node-based apps store a temporary unix socket for IPC. What I see as a problem (I understand this is not a bug, but a implementation decision, though IMO it would be better to change it) is that when Atom is not able to create an IPC socket (or on any other significant, though not critical error), it silently ignores the error and continues as if everything was OK. Then we observe a degradation in user experience without understanding the real cause. In my case it was that Atom was not detecting correctly that there was already a running instance so it was creating a new window for each new file opened externally (via shell/cli). Though, it does create an error file ~/.atom/nohup.out with the following content:
Application server failed { Error: listen EACCES ~/.tmp/atom-1.12.3-userx.sock
at Object.exports._errnoException (util.js:1008:11)
at exports._exceptionWithHostPort (util.js:1031:20)
at Server._listen2 (net.js:1240:19)
at listen (net.js:1289:10)
at Server.listen (net.js:1378:5)
at AtomApplication.module.exports.AtomApplication.listenForArgumentsFromNewProcess (/opt/atom/resources/app.asar/src/main-process/atom-application.js:282:14)
at AtomApplication.module.exports.AtomApplication.initialize (/opt/atom/resources/app.asar/src/main-process/atom-application.js:120:12)
at Function.module.exports.AtomApplication.open (/opt/atom/resources/app.asar/src/main-process/atom-application.js:59:38)
at App.<anonymous> (/opt/atom/resources/app.asar/src/main-process/start.js:68:21)
at emitTwo (events.js:111:20)
at App.emit (events.js:191:7)
code: 'EACCES',
errno: 'EACCES',
syscall: 'listen',
address: '~/.tmp/atom-1.12.3-userx.sock',
port: -1 }
For a comparison (and this is how the error was discovered) Visual Studio Code (which is also node-based) reports the error on initialization and fails to start.