Partial export processing
This commit is contained in:
@@ -597,6 +597,48 @@ module.exports.executeMount = (version, provider, remote, location, exitCallback
|
||||
|
||||
module.exports.exportAllSkylinks = _exportAllSkylinks;
|
||||
|
||||
module.exports.exportSkylinks = (version, paths) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const repertoryExec = _getRepertoryExec(version);
|
||||
const processOptions = {
|
||||
cwd: repertoryExec.working,
|
||||
detached: true,
|
||||
shell: false,
|
||||
windowsHide: true,
|
||||
};
|
||||
|
||||
const args = _getDefaultRepertoryArgs('Skynet');
|
||||
args.push('-ex');
|
||||
args.push(paths.join(','));
|
||||
|
||||
let result = '';
|
||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||
|
||||
process.on('error', (err) => {
|
||||
reject(err);
|
||||
});
|
||||
|
||||
process.stdout.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
|
||||
process.stderr.on('data', (d) => {
|
||||
result += d;
|
||||
});
|
||||
|
||||
process.on('exit', code => {
|
||||
if (code === 0) {
|
||||
result = result.substr(result.indexOf('{'));
|
||||
resolve(JSON.parse(result));
|
||||
} else {
|
||||
reject(new Error('Failed to import: ' + code + ':' + result));
|
||||
}
|
||||
});
|
||||
|
||||
process.unref();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getConfig = (version, provider, remote) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const repertoryExec = _getRepertoryExec(version);
|
||||
|
||||
Reference in New Issue
Block a user