Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zh99998 committed Nov 4, 2016
1 parent f4f5f72 commit eb9e663
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"webpack-shell-plugin": "^0.4.2"
},
"dependencies": {
"bluebird": "^3.4.6"
"bluebird": "^3.4.6",
"fs-extra": "^1.0.0"
}
}
22 changes: 11 additions & 11 deletions src/lib/sudoer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {watchFile, unwatchFile, unlink, createReadStream, createWriteStream} fro
import {normalize, join, dirname} from 'path';
import {createHash} from 'crypto';

import {copy} from 'fs-extra';

import {readFile, writeFile, exec, spawn, mkdir, stat} from '~/lib/utils';

let {platform, env} = process;
Expand Down Expand Up @@ -61,17 +63,15 @@ class SudoerUnix extends Sudoer {
if (!this.options.name) { this.options.name = 'Electron'; }
}

async copy(source, target) {
return new Promise(async (resolve, reject) => {
source = this.escapeDoubleQuotes(normalize(source));
target = this.escapeDoubleQuotes(normalize(target));
try {
let result = await exec(`/bin/cp -R -p "${source}" "${target}"`);
resolve(result);
}
catch (err) {
reject(err);
}
copy(source, target) {
return new Promise((resolve, reject) => {
copy(source, target, (error) => {
if (error) {
reject(error);
} else {
resolve();
}
})
});
}

Expand Down

0 comments on commit eb9e663

Please sign in to comment.