From d0fee2b8d01ac6cebdbd6009d251c51b81ea513d Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Mon, 5 Jun 2023 22:54:08 +0200 Subject: fixing windows install issue --- extension/src/activation/environmentSetup.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'extension/src/activation/environmentSetup.ts') diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 21f867b1..2410dcca 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -14,7 +14,7 @@ async function runCommand(cmd: string): Promise<[string, string | undefined]> { var stdout: any = ""; var stderr: any = ""; try { - var { stdout, stderr } = await exec(cmd); + var { stdout, stderr } = await exec(cmd, {'shell':'powershell.exe'}); } catch (e: any) { stderr = e.stderr; stdout = e.stdout; @@ -70,7 +70,7 @@ function checkEnvExists() { ); return ( fs.existsSync(path.join(envBinPath, "activate")) && - fs.existsSync(path.join(envBinPath, "pip")) + fs.existsSync(path.join(envBinPath, process.platform == "win32" ? "pip.exe" : "pip")) ); } @@ -88,7 +88,11 @@ async function setupPythonEnv() { const createEnvCommand = [ `cd ${path.join(getExtensionUri().fsPath, "scripts")}`, `${pythonCmd} -m venv env`, - ].join(" ; "); + ].join("; "); + + const [here, something] = await runCommand(`cd ${path.join(getExtensionUri().fsPath, "scripts")}`); + const [here1, something1] = await runCommand('cd c:\\Users\\Ty\\Documents\\continuedev\\continue\\extension\\scripts; python -m venv env'); + // console.log('cd c:\\Users\\Ty\\Documents\\continuedev\\continue\\extension\\scripts; c:\\Program` Files\\Python310\\python.exe -m venv env'); // Repeat until it is successfully created (sometimes it fails to generate the bin, need to try again) while (true) { -- cgit v1.2.3-70-g09d2 From f10b489562849958be118e9abee6d8fb692d756d Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 6 Jun 2023 00:23:56 -0400 Subject: cleaning up with win32 check for powershell --- extension/src/activation/environmentSetup.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'extension/src/activation/environmentSetup.ts') diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 2410dcca..bc071461 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -5,7 +5,6 @@ const { spawn } = require("child_process"); import * as path from "path"; import * as fs from "fs"; import rebuild from "@electron/rebuild"; -import * as vscode from "vscode"; import { getContinueServerUrl } from "../bridge"; import fetch from "node-fetch"; @@ -14,7 +13,9 @@ async function runCommand(cmd: string): Promise<[string, string | undefined]> { var stdout: any = ""; var stderr: any = ""; try { - var { stdout, stderr } = await exec(cmd, {'shell':'powershell.exe'}); + var { stdout, stderr } = await exec(cmd, { + shell: process.platform === "win32" ? "powershell.exe" : undefined, + }); } catch (e: any) { stderr = e.stderr; stdout = e.stdout; @@ -70,7 +71,9 @@ function checkEnvExists() { ); return ( fs.existsSync(path.join(envBinPath, "activate")) && - fs.existsSync(path.join(envBinPath, process.platform == "win32" ? "pip.exe" : "pip")) + fs.existsSync( + path.join(envBinPath, process.platform == "win32" ? "pip.exe" : "pip") + ) ); } @@ -90,10 +93,6 @@ async function setupPythonEnv() { `${pythonCmd} -m venv env`, ].join("; "); - const [here, something] = await runCommand(`cd ${path.join(getExtensionUri().fsPath, "scripts")}`); - const [here1, something1] = await runCommand('cd c:\\Users\\Ty\\Documents\\continuedev\\continue\\extension\\scripts; python -m venv env'); - // console.log('cd c:\\Users\\Ty\\Documents\\continuedev\\continue\\extension\\scripts; c:\\Program` Files\\Python310\\python.exe -m venv env'); - // Repeat until it is successfully created (sometimes it fails to generate the bin, need to try again) while (true) { const [, stderr] = await runCommand(createEnvCommand); -- cgit v1.2.3-70-g09d2