Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS IPC Path broken with modified TMPDIR #54

Closed
spkane opened this issue Jan 11, 2019 · 4 comments
Closed

MacOS IPC Path broken with modified TMPDIR #54

spkane opened this issue Jan 11, 2019 · 4 comments

Comments

@spkane
Copy link

spkane commented Jan 11, 2019

The IPC path on MacOS Mojave is here on my system:

$ find /private/var/folders -name "*discord-ipc*" 2> /dev/null

/private/var/folders/kh/388s01ns6r9480zhlk51nb200000gn/T/discord-ipc-0

I had to modify the ipc.js file to get this working.

I'm assuming that this path is slightly different on people's systems, but a code fix for Darwin system to determine the correct path under /private/var/folders would be very helpful.

I am not using this code directly, but it is a dependency for a plugin I use in my IDE.

Thanks!

@devsnek
Copy link
Member

devsnek commented Jan 11, 2019

I'm using the same code that discord's reference implementation uses:

https://github.com/discordapp/discord-rpc/blob/4e53fa0392bdb7c301abd48b973204e2cacbaede/src/connection_unix.cpp#L29-L37

function getIPCPath(id) {
if (process.platform === 'win32') {
return `\\\\?\\pipe\\discord-ipc-${id}`;
}
const { env: { XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP } } = process;
const prefix = XDG_RUNTIME_DIR || TMPDIR || TMP || TEMP || '/tmp';
return `${prefix.replace(/\/$/, '')}/discord-ipc-${id}`;
}

@spkane
Copy link
Author

spkane commented Jan 11, 2019

That code simply doesn't work on Darwin/MacOS (at least anymore).

On macOS Mojave that code returns /tmp/discord-ipc-0 on my system.

On MacOS /tmp is a link to /private/tmp, but the IPC file is actually under /private/var and is then still buried further down /private/var/folders/kh/388s01ns6r9480zhlk51nb200000gn/T/discord-ipc-0.

@devsnek
Copy link
Member

devsnek commented Jan 11, 2019

@spkane it works fine for me and other people i've been talking to about this... are you sure your env isn't messed up?

@spkane
Copy link
Author

spkane commented Jan 11, 2019

Not exactly messed up, but I think I see what is happening, now that you posted that image.

In my .bashrc, I very reasonably have set:

export TMPDIR="/tmp"

This impacts Visual Studio Code and the node code, as I want in general, but the issue is that the Discord Desktop does not get that environment, and writes things into the "default" user tmp dir.

Well, I will go ahead and pull that out for now since it is not vital, at the moment.

But, it still feels a bit like a bug somewhere, anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants