mirror of
https://github.com/coder/code-server.git
synced 2026-05-07 12:57:26 +02:00
Extract ripgrep when inside binary
This commit is contained in:
15
src/util.ts
15
src/util.ts
@@ -4,6 +4,7 @@ import * as fs from "fs";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import * as util from "util";
|
||||
import * as rg from "vscode-ripgrep";
|
||||
|
||||
import { getPathFromAmdModule } from "vs/base/common/amd";
|
||||
import { getMediaMime as vsGetMediaMime } from "vs/base/common/mime";
|
||||
@@ -114,3 +115,17 @@ export const open = async (url: string): Promise<void> => {
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Extract executables to the temporary directory. This is required since we
|
||||
* can't execute binaries stored within our binary.
|
||||
*/
|
||||
export const unpackExecutables = async (): Promise<void> => {
|
||||
const rgPath = (rg as any).binaryRgPath;
|
||||
if (rgPath) {
|
||||
await mkdirp(tmpdir);
|
||||
const destination = path.join(tmpdir, path.basename(rgPath));
|
||||
await util.promisify(fs.copyFile)(rgPath, destination);
|
||||
await util.promisify(fs.chmod)(destination, "755");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user