summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-08-03 01:11:41 -0700
committerNate Sesti <sestinj@gmail.com>2023-08-03 01:11:41 -0700
commitbfd2f09cd6ebdc18e8162555a1859f0098b14cd3 (patch)
tree05b2bf8ac613b9af56c17e14179a87cceb80f8ea
parent66b3a267c875f6d445032440de6a48982402f60e (diff)
downloadsncontinue-bfd2f09cd6ebdc18e8162555a1859f0098b14cd3.tar.gz
sncontinue-bfd2f09cd6ebdc18e8162555a1859f0098b14cd3.tar.bz2
sncontinue-bfd2f09cd6ebdc18e8162555a1859f0098b14cd3.zip
small fixes to setup
-rw-r--r--continuedev/src/continuedev/libs/util/paths.py20
-rw-r--r--extension/src/activation/environmentSetup.ts20
2 files changed, 22 insertions, 18 deletions
diff --git a/continuedev/src/continuedev/libs/util/paths.py b/continuedev/src/continuedev/libs/util/paths.py
index 1e11898f..83a472ad 100644
--- a/continuedev/src/continuedev/libs/util/paths.py
+++ b/continuedev/src/continuedev/libs/util/paths.py
@@ -36,16 +36,20 @@ def getConfigFilePath() -> str:
path = os.path.join(getGlobalFolderPath(), "config.py")
os.makedirs(os.path.dirname(path), exist_ok=True)
- with open(path, 'r') as f:
- existing_content = f.read()
-
- if not os.path.exists(path) or existing_content.strip() == "":
+ if not os.path.exists(path):
with open(path, 'w') as f:
f.write(default_config)
- elif " continuedev.core" in existing_content:
- with open(path, 'w') as f:
- f.write(existing_content.replace(" continuedev.",
- " continuedev.src.continuedev."))
+ else:
+ with open(path, 'r') as f:
+ existing_content = f.read()
+
+ if existing_content.strip() == "":
+ with open(path, 'w') as f:
+ f.write(default_config)
+ elif " continuedev.core" in existing_content:
+ with open(path, 'w') as f:
+ f.write(existing_content.replace(" continuedev.",
+ " continuedev.src.continuedev."))
return path
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index 8d9578e8..db457bd2 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -83,23 +83,23 @@ export function getExtensionVersion() {
// Returns whether a server of the current version is already running
async function checkOrKillRunningServer(serverUrl: string): Promise<boolean> {
console.log("Checking if server is old version");
+ const serverRunning = await checkServerRunning(serverUrl);
// Kill the server if it is running an old version
if (fs.existsSync(serverVersionPath())) {
const serverVersion = fs.readFileSync(serverVersionPath(), "utf8");
- if (
- serverVersion === getExtensionVersion() &&
- (await checkServerRunning(serverUrl))
- ) {
+ if (serverVersion === getExtensionVersion() && serverRunning) {
// The current version is already up and running, no need to continue
return true;
}
}
- console.log("Killing old server...");
- try {
- await fkill(":65432");
- } catch (e: any) {
- if (!e.message.includes("Process doesn't exist")) {
- console.log("Failed to kill old server:", e);
+ if (serverRunning) {
+ console.log("Killing old server...");
+ try {
+ await fkill(":65432");
+ } catch (e: any) {
+ if (!e.message.includes("Process doesn't exist")) {
+ console.log("Failed to kill old server:", e);
+ }
}
}
return false;