mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 20:55:30 +02:00
Catch spawn errors
This commit is contained in:
parent
54a7f4f774
commit
a49abc7c67
1 changed files with 20 additions and 3 deletions
|
@ -172,7 +172,13 @@ module.exports = class ArchiveUtil {
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = archiver.compress.args.map( arg => stringFormat(arg, fmtObj) );
|
const args = archiver.compress.args.map( arg => stringFormat(arg, fmtObj) );
|
||||||
const proc = pty.spawn(archiver.compress.cmd, args, this.getPtyOpts());
|
|
||||||
|
let proc;
|
||||||
|
try {
|
||||||
|
proc = pty.spawn(archiver.compress.cmd, args, this.getPtyOpts());
|
||||||
|
} catch(e) {
|
||||||
|
return cb(e);
|
||||||
|
}
|
||||||
|
|
||||||
return this.spawnHandler(proc, 'Compression', cb);
|
return this.spawnHandler(proc, 'Compression', cb);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +218,12 @@ module.exports = class ArchiveUtil {
|
||||||
args.splice.apply(args, [fileListPos, 1].concat(fileList));
|
args.splice.apply(args, [fileListPos, 1].concat(fileList));
|
||||||
}
|
}
|
||||||
|
|
||||||
const proc = pty.spawn(archiver[action].cmd, args, this.getPtyOpts());
|
let proc;
|
||||||
|
try {
|
||||||
|
proc = pty.spawn(archiver[action].cmd, args, this.getPtyOpts());
|
||||||
|
} catch(e) {
|
||||||
|
return cb(e);
|
||||||
|
}
|
||||||
|
|
||||||
return this.spawnHandler(proc, (haveFileList ? 'Extraction' : 'Decompression'), cb);
|
return this.spawnHandler(proc, (haveFileList ? 'Extraction' : 'Decompression'), cb);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +240,13 @@ module.exports = class ArchiveUtil {
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = archiver.list.args.map( arg => stringFormat(arg, fmtObj) );
|
const args = archiver.list.args.map( arg => stringFormat(arg, fmtObj) );
|
||||||
const proc = pty.spawn(archiver.list.cmd, args, this.getPtyOpts());
|
|
||||||
|
let proc;
|
||||||
|
try {
|
||||||
|
proc = pty.spawn(archiver.list.cmd, args, this.getPtyOpts());
|
||||||
|
} catch(e) {
|
||||||
|
return cb(e);
|
||||||
|
}
|
||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
proc.on('data', data => {
|
proc.on('data', data => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue