mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Add custom path for vscode-server socket files and named pipe length (#172481)
* Add custom path for vscode-server socket files and named pipe length
* Revert VSCODE_SOCKETS_DIR to XDG_RUNTIME_DIR behavior
* 💄
---------
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
This commit is contained in:
parent
3133ffcd12
commit
a0bf7f5b13
|
@ -759,11 +759,20 @@ export function createStaticIPCHandle(directoryPath: string, type: string, versi
|
|||
// Mac/Unix: use socket file and prefer
|
||||
// XDG_RUNTIME_DIR over user data path
|
||||
// unless portable
|
||||
// Trim the version and type values for
|
||||
// the socket to prevent too large
|
||||
// file names causing issues:
|
||||
// https://unix.stackexchange.com/questions/367008/why-is-socket-path-length-limited-to-a-hundred-chars
|
||||
|
||||
const versionForSocket = version.substr(0, 4);
|
||||
const typeForSocket = type.substr(0, 6);
|
||||
const scopeForSocket = scope.substr(0, 8);
|
||||
|
||||
let result: string;
|
||||
if (XDG_RUNTIME_DIR && !process.env['VSCODE_PORTABLE']) {
|
||||
result = join(XDG_RUNTIME_DIR, `vscode-${scope.substr(0, 8)}-${version}-${type}.sock`);
|
||||
result = join(XDG_RUNTIME_DIR, `vscode-${scopeForSocket}-${versionForSocket}-${typeForSocket}.sock`);
|
||||
} else {
|
||||
result = join(directoryPath, `${version}-${type}.sock`);
|
||||
result = join(directoryPath, `${versionForSocket}-${typeForSocket}.sock`);
|
||||
}
|
||||
|
||||
// Validate length
|
||||
|
|
Loading…
Reference in a new issue