Skip to content

Commit 245979f

Browse files
Fix reading JUPYTER_RUNTIME_DIR and XDG_RUNTIME_DIR (#16451)
Signed-off-by: Mathew Wicks <[email protected]>
1 parent 9f67a49 commit 245979f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/kernels/raw/finder/jupyterPaths.node.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,18 @@ export class JupyterPaths {
133133
private async getRuntimeDirImpl(): Promise<Uri | undefined> {
134134
let runtimeDir: Uri | undefined;
135135
const userHomeDir = this.platformService.homeDir;
136-
if (userHomeDir) {
136+
if (process.env['JUPYTER_RUNTIME_DIR']) {
137+
runtimeDir = Uri.file(path.normalize(process.env['JUPYTER_RUNTIME_DIR']));
138+
} else if (userHomeDir) {
137139
if (this.platformService.isWindows) {
138140
// On windows the path is not correct if we combine those variables.
139141
// It won't point to a path that you can actually read from.
140142
runtimeDir = await tryGetRealPath(uriPath.joinPath(userHomeDir, winJupyterRuntimePath));
141143
} else if (this.platformService.isMac) {
142144
runtimeDir = uriPath.joinPath(userHomeDir, macJupyterRuntimePath);
143145
} else {
144-
runtimeDir = process.env['$XDG_RUNTIME_DIR']
145-
? Uri.file(path.join(process.env['$XDG_RUNTIME_DIR'], 'jupyter', 'runtime'))
146+
runtimeDir = process.env['XDG_RUNTIME_DIR']
147+
? Uri.file(path.join(process.env['XDG_RUNTIME_DIR'], 'jupyter', 'runtime'))
146148
: uriPath.joinPath(userHomeDir, '.local', 'share', 'jupyter', 'runtime');
147149
}
148150
}

0 commit comments

Comments
 (0)