Skip to content
Permalink
Browse files

refactor(installer): check that the linux installer program exists first

  • Loading branch information
malept authored and MarshallOfSound committed Dec 30, 2016
1 parent fb217c7 commit fb56c5428830f7ce479e60ae14d3d7e861493114
Showing with 13 additions and 2 deletions.
  1. +4 −2 src/installers/linux/deb.js
  2. +9 −0 src/util/linux-installer.js
@@ -1,8 +1,10 @@
import pify from 'pify';
import sudo from 'sudo-prompt';

import linuxInstaller from '../../util/linux-installer';

export default async (filePath) => {
await pify(sudo.exec)(`gdebi -n ${filePath}`, {
linuxInstaller('Debian', 'gdebi', pify(sudo.exec)(`gdebi -n ${filePath}`, {
name: 'Electron Forge',
});
}));
};
@@ -0,0 +1,9 @@
import { spawnSync } from 'child_process';

export default async (type, prog, promise) => {
if (spawnSync('which', [prog]).status === 0) {
await promise;
} else {
throw new Error(`${prog} is required to install ${type} packages`);
}
};

0 comments on commit fb56c54

Please sign in to comment.
You can’t perform that action at this time.