refactor(installer): finish replacing sudo-prompt with electron-sudo

This commit is contained in:
Mark Lee 2016-12-31 13:02:05 -08:00
Родитель 23ea0de3f1
Коммит 0a21433848
2 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -82,7 +82,6 @@
"pify": "^2.3.0",
"resolve-package": "^1.0.1",
"semver": "^5.3.0",
"sudo-prompt": "^6.2.1",
"username": "^2.2.2",
"yarn-or-npm": "^2.0.2",
"zip-folder": "^1.0.0"

Просмотреть файл

@ -2,7 +2,7 @@ import fs from 'fs-promise';
import inquirer from 'inquirer';
import path from 'path';
import pify from 'pify';
import sudo from 'sudo-prompt';
import { default as Sudoer } from 'electron-sudo';
import { exec, spawn } from 'child_process';
export default async (filePath, installSpinner) => {
@ -44,9 +44,8 @@ export default async (filePath, installSpinner) => {
if (writeAccess) {
await pify(exec)(moveCommand);
} else {
await pify(sudo.exec)(moveCommand, {
name: 'Electron Forge',
});
const sudoer = new Sudoer({ name: 'Electron Forge' });
await sudoer.exec(moveCommand);
}
spawn('open', ['-R', targetApplicationPath], { detached: true });