7zip-min
Advanced tools
Comparing version 1.3.3 to 1.4.0
# Changelog | ||
## v1.4.0 | ||
- add 7z output to error object (you will have more ideas on why 7z failed) | ||
- add spawn option `{windowsHide: true}` (it will hide the subprocess console window that would normally be created on Windows systems.) | ||
Thanks [@milahu](https://github.com/milahu) for that features. | ||
## v1.3.3 | ||
@@ -4,0 +11,0 @@ |
11
index.js
@@ -54,3 +54,4 @@ 'use strict'; | ||
cb = onceify(cb); | ||
const proc = spawn(bin, args); | ||
const runError = new Error(); // get full stack trace | ||
const proc = spawn(bin, args, {windowsHide: true}); | ||
let output = ''; | ||
@@ -65,3 +66,6 @@ proc.on('error', function (err) { | ||
} | ||
cb(code ? new Error('Exited with code ' + code) : null, result); | ||
if (code) { | ||
runError.message = `7-zip exited with code ${code}\n${output}`; | ||
} | ||
cb(code ? runError : null, result); | ||
}); | ||
@@ -71,2 +75,5 @@ proc.stdout.on('data', (chunk) => { | ||
}); | ||
proc.stderr.on('data', (chunk) => { | ||
output += chunk.toString(); | ||
}); | ||
} | ||
@@ -73,0 +80,0 @@ |
{ | ||
"name": "7zip-min", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "Standalone cross-platform zip/unzip with 7za", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,2 +104,14 @@ 'use strict'; | ||
test.serial('pack path that does not exist', async t => { | ||
const wrongPath = join(__dirname, 'noPath'); | ||
const error = await t.throwsAsync(async () => { | ||
await t2p(cb => { | ||
_7z.pack(join(wrongPath), ARCH_PATH, cb); | ||
}); | ||
}); | ||
// error output should contain wrong path | ||
const hasWrongPathMentioning = error.message.indexOf(wrongPath) !== -1; | ||
t.true(hasWrongPathMentioning); | ||
}); | ||
test.after.always('cleanup', async t => { | ||
@@ -106,0 +118,0 @@ await remove(SRC_DIR_PATH); |
16260
255