aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/installation/server.ts')
-rw-r--r--editors/code/src/installation/server.ts19
1 files changed, 10 insertions, 9 deletions
diff --git a/editors/code/src/installation/server.ts b/editors/code/src/installation/server.ts
index 750852921..685abfdc6 100644
--- a/editors/code/src/installation/server.ts
+++ b/editors/code/src/installation/server.ts
@@ -7,6 +7,7 @@ import { spawnSync } from "child_process";
7import { BinarySource } from "./interfaces"; 7import { BinarySource } from "./interfaces";
8import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; 8import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info";
9import { downloadArtifact } from "./download_artifact"; 9import { downloadArtifact } from "./download_artifact";
10import { log } from "../util";
10 11
11export async function ensureServerBinary(source: null | BinarySource): Promise<null | string> { 12export async function ensureServerBinary(source: null | BinarySource): Promise<null | string> {
12 if (!source) { 13 if (!source) {
@@ -40,7 +41,7 @@ export async function ensureServerBinary(source: null | BinarySource): Promise<n
40 const installedVersion: null | string = getServerVersion(source.storage); 41 const installedVersion: null | string = getServerVersion(source.storage);
41 const requiredVersion: string = source.version; 42 const requiredVersion: string = source.version;
42 43
43 console.log("Installed version:", installedVersion, "required:", requiredVersion); 44 log.debug("Installed version:", installedVersion, "required:", requiredVersion);
44 45
45 if (isBinaryAvailable(prebuiltBinaryPath) && installedVersion === requiredVersion) { 46 if (isBinaryAvailable(prebuiltBinaryPath) && installedVersion === requiredVersion) {
46 return prebuiltBinaryPath; 47 return prebuiltBinaryPath;
@@ -72,16 +73,16 @@ async function downloadServer(source: BinarySource.GithubRelease): Promise<boole
72 `GitHub repository: ${err.message}` 73 `GitHub repository: ${err.message}`
73 ); 74 );
74 75
75 console.error(err); 76 log.error(err);
76 77
77 dns.resolve('example.com').then( 78 dns.resolve('example.com').then(
78 addrs => console.log("DNS resolution for example.com was successful", addrs), 79 addrs => log.debug("DNS resolution for example.com was successful", addrs),
79 err => { 80 err => {
80 console.error( 81 log.error(
81 "DNS resolution for example.com failed, " + 82 "DNS resolution for example.com failed, " +
82 "there might be an issue with Internet availability" 83 "there might be an issue with Internet availability"
83 ); 84 );
84 console.error(err); 85 log.error(err);
85 } 86 }
86 ); 87 );
87 return false; 88 return false;
@@ -105,19 +106,19 @@ function isBinaryAvailable(binaryPath: string): boolean {
105 // ACHTUNG! `res` type declaration is inherently wrong, see 106 // ACHTUNG! `res` type declaration is inherently wrong, see
106 // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221 107 // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/42221
107 108
108 console.log("Checked binary availablity via --version", res); 109 log.debug("Checked binary availablity via --version", res);
109 console.log(binaryPath, "--version output:", res.output?.map(String)); 110 log.debug(binaryPath, "--version output:", res.output?.map(String));
110 111
111 return res.status === 0; 112 return res.status === 0;
112} 113}
113 114
114function getServerVersion(storage: vscode.Memento): null | string { 115function getServerVersion(storage: vscode.Memento): null | string {
115 const version = storage.get<null | string>("server-version", null); 116 const version = storage.get<null | string>("server-version", null);
116 console.log("Get server-version:", version); 117 log.debug("Get server-version:", version);
117 return version; 118 return version;
118} 119}
119 120
120async function setServerVersion(storage: vscode.Memento, version: string): Promise<void> { 121async function setServerVersion(storage: vscode.Memento, version: string): Promise<void> {
121 console.log("Set server-version:", version); 122 log.debug("Set server-version:", version);
122 await storage.update("server-version", version.toString()); 123 await storage.update("server-version", version.toString());
123} 124}