From 9ccf760a80c21725b526c175440a7889697f816e Mon Sep 17 00:00:00 2001 From: Lukas Geiger Date: Sat, 28 Oct 2017 17:32:39 +0200 Subject: [PATCH] Await Atom's shell environement load --- lib/main.js | 8 +++----- package.json | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/main.js b/lib/main.js index f57a1e9b..adff7959 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,5 +1,4 @@ const cp = require("child_process"); -const shellEnv = require("shell-env"); const { shell } = require("electron"); const { AutoLanguageClient } = require("atom-languageclient"); @@ -29,11 +28,10 @@ class PythonLanguageClient extends AutoLanguageClient { } async startServerProcess(projectPath) { - // For some reason Atom only detects the correct env if started from the command line on Mac. - const env = process.platform === "darwin" ? await shellEnv() : process.env; + await new Promise(resolve => atom.whenShellEnvironmentLoaded(resolve)); + const childProcess = cp.spawn(atom.config.get("ide-python.pylsPath"), { - cwd: projectPath, - env: env + cwd: projectPath }); childProcess.on("error", err => atom.notifications.addError( diff --git a/package.json b/package.json index 259df141..c8d86254 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,7 @@ "atom": ">=1.21.0 <2.0.0" }, "dependencies": { - "atom-languageclient": "^0.6.4", - "shell-env": "^0.3.0" + "atom-languageclient": "^0.6.4" }, "enhancedScopes": [ "source.python"