aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/installation/download_file.ts8
-rw-r--r--editors/code/src/installation/language_server.ts5
2 files changed, 8 insertions, 5 deletions
diff --git a/editors/code/src/installation/download_file.ts b/editors/code/src/installation/download_file.ts
index 8a0766c66..f1f9f4a25 100644
--- a/editors/code/src/installation/download_file.ts
+++ b/editors/code/src/installation/download_file.ts
@@ -3,7 +3,7 @@ import * as fs from "fs";
3import { strict as assert } from "assert"; 3import { strict as assert } from "assert";
4 4
5/** 5/**
6 * Downloads file from `url` and stores it at `destFilePath`. 6 * Downloads file from `url` and stores it at `destFilePath` with `destFilePermissions`.
7 * `onProgress` callback is called on recieveing each chunk of bytes 7 * `onProgress` callback is called on recieveing each chunk of bytes
8 * to track the progress of downloading, it gets the already read and total 8 * to track the progress of downloading, it gets the already read and total
9 * amount of bytes to read as its parameters. 9 * amount of bytes to read as its parameters.
@@ -11,6 +11,7 @@ import { strict as assert } from "assert";
11export async function downloadFile( 11export async function downloadFile(
12 url: string, 12 url: string,
13 destFilePath: fs.PathLike, 13 destFilePath: fs.PathLike,
14 destFilePermissions: number,
14 onProgress: (readBytes: number, totalBytes: number) => void 15 onProgress: (readBytes: number, totalBytes: number) => void
15): Promise<void> { 16): Promise<void> {
16 const res = await fetch(url); 17 const res = await fetch(url);
@@ -35,6 +36,9 @@ export async function downloadFile(
35 onProgress(readBytes, totalBytes); 36 onProgress(readBytes, totalBytes);
36 }) 37 })
37 .on("error", reject) 38 .on("error", reject)
38 .pipe(fs.createWriteStream(destFilePath).on("close", resolve)) 39 .pipe(fs
40 .createWriteStream(destFilePath, { mode: destFilePermissions })
41 .on("close", resolve)
42 )
39 ); 43 );
40} 44}
diff --git a/editors/code/src/installation/language_server.ts b/editors/code/src/installation/language_server.ts
index 3510f9178..52c5cbe7d 100644
--- a/editors/code/src/installation/language_server.ts
+++ b/editors/code/src/installation/language_server.ts
@@ -35,7 +35,8 @@ export async function downloadLatestLanguageServer(
35 }, 35 },
36 async (progress, _cancellationToken) => { 36 async (progress, _cancellationToken) => {
37 let lastPrecentage = 0; 37 let lastPrecentage = 0;
38 await downloadFile(downloadUrl, installationPath, throttle( 38 const filePermissions = 0o755; // (rwx, r_x, r_x)
39 await downloadFile(downloadUrl, installationPath, filePermissions, throttle(
39 200, 40 200,
40 /* noTrailing: */ true, 41 /* noTrailing: */ true,
41 (readBytes, totalBytes) => { 42 (readBytes, totalBytes) => {
@@ -51,8 +52,6 @@ export async function downloadLatestLanguageServer(
51 } 52 }
52 ); 53 );
53 console.timeEnd("Downloading ra_lsp_server"); 54 console.timeEnd("Downloading ra_lsp_server");
54
55 await fs.chmod(installationPath, 0o755); // Set (rwx, r_x, r_x) permissions
56} 55}
57export async function ensureLanguageServerBinary( 56export async function ensureLanguageServerBinary(
58 langServerSource: null | BinarySource 57 langServerSource: null | BinarySource