-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(installer): check that the linux installer program exists first
- Loading branch information
1 parent
fb217c7
commit fb56c54
Showing
2 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
}); | ||
})); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`); | ||
} | ||
}; |