RPC icon indicating copy to clipboard operation
RPC copied to clipboard

Fix getIPCPath on darwin (macOS) under a parent process

Open SamJakob opened this issue 4 years ago • 5 comments

On Darwin (macOS), under a parent process, the environment args might not be correctly passed and os.tmpdir() returns a subdirectory of the root temp dir. This PR therefore uses os.tmpdir() to ensure the environment args aren't modified and gets the parent of the subdirectory if it is detected that the returned temp directory is in a subdirectory.

SamJakob avatar Feb 02 '21 23:02 SamJakob

Any update on this?

Benricheson101 avatar Aug 27 '21 01:08 Benricheson101

@kyranet

leonardssh avatar Aug 27 '21 06:08 leonardssh

cc: @devsnek

kyranet avatar Aug 27 '21 06:08 kyranet

This fix doesn't seem to work for me 😦 The paths appear as this which isn't the ipc directory: CleanShot 2022-07-06 at 11 54 58@2x My actual IPC directory should be this: CleanShot 2022-07-06 at 11 56 20@2x

tandpfun avatar Jul 06 '22 18:07 tandpfun

Here's inline fix

import fs from "fs";

for (const key of ['XDG_RUNTIME_DIR', 'TMPDIR', 'TMP', 'TEMP']) {
	if (process.env[key]) process.env[key] = fs.realpathSync(process.env[key] as string);
}

(i also have a fork that should fix this problem)

xhayper avatar Jul 29 '22 06:07 xhayper