community: If TMPDIR environment variable is set, vscode integration does not accept commands

A random piece of software on my machine (Windows 10) had set this the system environment variable TMPDIR, which caused the vscode integration to not accept commands. I believe this is because the function get_communication_dir_path() uses gettempdir(): https://github.com/knausj85/knausj_talon/blob/main/apps/vscode/command_client/command_client.py#L211-L224

which checks TMPDIR, TEMP, and TMP, in order, to choose a temporary directory.

On the extension side, node’s os.tmpdir() is used to select a temporary directory: https://github.com/pokey/command-server/blob/main/src/paths.ts#L4-L12

It’s not documented, but I believe this must not check the TMPDIR env variable, causing the two ends of the connection to choose different directories and miss each other.

(Not sure how to fix this. You could override the directory lookup, or just switch to using a socket lol.)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

to be clear, if we need to put this somewhere other than a temp directory to make it work for more people out of the box, I think we should do that. I just want to (a) avoid overcomplicating things if we don’t have to (b) make sure the alternative solution does work for more people out of the box. being able to use a ramdisk/tmpfs is a nice-to-have not a necessity.

If we put anything in the home dir, we’d also have to put it outside of a dot directory, since we’ve also seen snaps prevent access to dotfiles.

I mildly prefer using the temporary directory. I’ve put my temp dir on an in-memory filesystem so that all this command client traffic doesn’t have to hit my hard drive at all.