mirror of https://git.tuxpa.in/a/code-server.git
Use nbin in forked processes
This commit is contained in:
parent
6156eb9ff4
commit
3ca90a5f89
10
main.js
10
main.js
|
@ -1,11 +1 @@
|
|||
try {
|
||||
const nbin = require("nbin");
|
||||
const path = require("path");
|
||||
const rootPath = path.resolve(__dirname, "../../..");
|
||||
console.log("Shimming", rootPath);
|
||||
nbin.shimNativeFs(rootPath);
|
||||
} catch (error) {
|
||||
console.log("Not in the binary");
|
||||
}
|
||||
|
||||
require("../../bootstrap-amd").load("vs/server/cli");
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
if (!global.NBIN_LOADED) {
|
||||
try {
|
||||
const nbin = require("nbin");
|
||||
nbin.shimNativeFs("{{ROOT_PATH}}");
|
||||
global.NBIN_LOADED = true;
|
||||
} catch (error) {
|
||||
console.log("Not in the binary");
|
||||
}
|
||||
}
|
|
@ -41,6 +41,18 @@ function copy-server() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Prepend the nbin loading code which allows the code to find files within
|
||||
# the binary.
|
||||
function prepend-loader() {
|
||||
local filePath="${codeServerBuildPath}/${1}" ; shift
|
||||
cat "${rootPath}/scripts/nbin-loader.js" "${filePath}" > "${filePath}.temp"
|
||||
mv "${filePath}.temp" "${filePath}"
|
||||
# Using : as the delimiter so the escaping here is easier to read.
|
||||
# ${parameter/pattern/string}, so the pattern is /: (if the pattern starts
|
||||
# with / it matches all instances) and the string is \\: (results in \:).
|
||||
sed -i "s:{{ROOT_PATH}}:${codeServerBuildPath//:/\\:}:g" "${filePath}"
|
||||
}
|
||||
|
||||
# Copy code-server into VS Code then build it.
|
||||
function build-code-server() {
|
||||
copy-server
|
||||
|
@ -62,6 +74,9 @@ function build-code-server() {
|
|||
rm -rf "${codeServerBuildPath}/out/vs/server/node_modules"
|
||||
cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}"
|
||||
|
||||
prepend-loader "out/vs/server/main.js"
|
||||
prepend-loader "out/bootstrap-fork.js"
|
||||
|
||||
log "Final build: ${codeServerBuildPath}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue