mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Display error dialog if extensions couldn't be loaded (#1752)
* Display error dialog if extensions couldn't be loaded * Reject npm install on failure using the process exit code Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
e408b0c6d9
commit
3300a99a78
3 files changed
+46
-20
No files matched your search
@@ -33,16 +33,26 @@ export class ExtensionInstaller {
|
||||
installDependencies(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
logger.info(`${logModule} installing dependencies at ${extensionPackagesRoot()}`);
|
||||
const child = child_process.fork(this.npmPath, ["install", "--silent", "--no-audit", "--only=prod", "--prefer-offline", "--no-package-lock"], {
|
||||
const child = child_process.fork(this.npmPath, ["install", "--no-audit", "--only=prod", "--prefer-offline", "--no-package-lock"], {
|
||||
cwd: extensionPackagesRoot(),
|
||||
silent: true
|
||||
});
|
||||
let stderr = "";
|
||||
|
||||
child.on("close", () => {
|
||||
resolve();
|
||||
child.stderr.on("data", data => {
|
||||
stderr += String(data);
|
||||
});
|
||||
child.on("error", (err) => {
|
||||
reject(err);
|
||||
|
||||
child.on("close", (code) => {
|
||||
if (code !== 0) {
|
||||
reject(new Error(stderr));
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
||||
child.on("error", error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user