[Registry] Minor source cleanup

This commit is contained in:
Ducko 2022-04-22 18:30:23 +01:00
parent b8f6784911
commit b51d358492
1 changed files with 6 additions and 6 deletions

View File

@ -1,19 +1,19 @@
const CP = require('child_process');
exports.spawn = (args, callback) => {
exports.spawn = (args, cb) => {
const process = CP.spawn('reg.exe', args);
let out = '';
process.stdout.on('data', data => out += data);
process.on('error', e => callback(e, out));
process.on('exit', (c, s) => callback(c !== 0 ? (s ?? c) : null, out));
process.on('error', e => cb(e, out));
process.on('exit', (c, s) => cb(c !== 0 ? (s ?? c) : null, out));
};
exports.add = (todo, callback) => {
exports.add = (todo, cb) => {
const x = todo.shift();
if (!x) return callback();
if (!x) return cb();
exports.spawn([ 'add', ...x, '/f' ], () => exports.add(todo, callback));
exports.spawn([ 'add', ...x, '/f' ], () => exports.add(todo, cb));
};