mirror of
https://github.com/coder/code-server.git
synced 2025-07-30 05:22:04 +08:00
chore(vscode): update to 1.55.2
This commit is contained in:
36
lib/vscode/src/bootstrap-node.js
vendored
36
lib/vscode/src/bootstrap-node.js
vendored
@ -6,6 +6,42 @@
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
// Setup current working directory in all our node & electron processes
|
||||
// - Windows: call `process.chdir()` to always set application folder as cwd
|
||||
// - Posix: allow to change the current working dir via `VSCODE_CWD` if defined
|
||||
// - all OS: store the `process.cwd()` inside `VSCODE_CWD` for consistent lookups
|
||||
// TODO@bpasero revisit if chdir() on Windows is needed in the future still
|
||||
function setupCurrentWorkingDirectory() {
|
||||
const path = require('path');
|
||||
|
||||
try {
|
||||
let cwd = process.env['VSCODE_CWD'];
|
||||
|
||||
// remember current working directory in environment
|
||||
// unless it was given to us already from outside
|
||||
if (typeof cwd !== 'string') {
|
||||
cwd = process.cwd();
|
||||
process.env['VSCODE_CWD'] = cwd;
|
||||
}
|
||||
|
||||
// Windows: always set application folder as current working dir
|
||||
if (process.platform === 'win32') {
|
||||
process.chdir(path.dirname(process.execPath));
|
||||
}
|
||||
|
||||
// Linux/macOS: allow to change current working dir based on env
|
||||
else {
|
||||
if (cwd !== process.cwd()) {
|
||||
process.chdir(cwd);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
setupCurrentWorkingDirectory();
|
||||
|
||||
/**
|
||||
* Add support for redirecting the loading of node modules
|
||||
*
|
||||
|
Reference in New Issue
Block a user