diff options
author | Kirill Dubovitskiy <kirill2003de@gmail.com> | 2023-08-05 01:28:20 -0700 |
---|---|---|
committer | Kirill Dubovitskiy <kirill2003de@gmail.com> | 2023-08-06 13:36:12 -0700 |
commit | 178e180e9c68ec7e89554c0b99a93dbb111c42b0 (patch) | |
tree | 797212361b4b07dfb25e54e8711c38423aa3b3c4 /extension/src/activation | |
parent | 2d665a41e76f67d1bb10d7c419634dc654e2d1f2 (diff) | |
download | sncontinue-178e180e9c68ec7e89554c0b99a93dbb111c42b0.tar.gz sncontinue-178e180e9c68ec7e89554c0b99a93dbb111c42b0.tar.bz2 sncontinue-178e180e9c68ec7e89554c0b99a93dbb111c42b0.zip |
Minor refactoring to fix up typing
Diffstat (limited to 'extension/src/activation')
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 1ca32841..7c18913a 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -1,7 +1,7 @@ import { getExtensionUri } from "../util/vscode"; -const util = require("util"); -const exec = util.promisify(require("child_process").exec); -const { spawn } = require("child_process"); +import { promisify } from "util"; +import { exec as execCb } from "child_process"; +import { spawn } from "child_process"; import * as path from "path"; import * as fs from "fs"; import { getContinueServerUrl } from "../bridge"; @@ -10,11 +10,13 @@ import * as vscode from "vscode"; import * as os from "os"; import fkill from "fkill"; import { finished } from "stream/promises"; -const request = require("request"); +import * as request from "request"; + +const exec = promisify(execCb); async function runCommand(cmd: string): Promise<[string, string | undefined]> { - var stdout: any = ""; - var stderr: any = ""; + var stdout = ""; + var stderr = ""; try { var { stdout, stderr } = await exec(cmd, { shell: process.platform === "win32" ? "powershell.exe" : undefined, @@ -23,14 +25,9 @@ async function runCommand(cmd: string): Promise<[string, string | undefined]> { stderr = e.stderr; stdout = e.stdout; } - if (stderr === "") { - stderr = undefined; - } - if (typeof stdout === "undefined") { - stdout = ""; - } - return [stdout, stderr]; + const stderrOrUndefined = stderr === "" ? undefined : stderr; + return [stdout, stderrOrUndefined]; } async function checkServerRunning(serverUrl: string): Promise<boolean> { |