Browse Source

fix: bw vulnerabilty & printing bw error properly

master
Andrew Kaiser 5 years ago
parent
commit
860bbd2711
4 changed files with 14 additions and 10 deletions
  1. +3
    -3
      bin/cli.js
  2. +6
    -6
      package-lock.json
  3. +1
    -1
      package.json
  4. +4
    -0
      src/util/error.js

+ 3
- 3
bin/cli.js View File

@ -7,7 +7,7 @@ const minimist = require('minimist')
const menu = require('../src')
const obfuscateState = require('../src/util/obfuscate')
const { scheduleCleanup } = require('../src/schedule-cleanup')
const { CancelError } = require('../src/util/error')
const { CancelError, CommandError } = require('../src/util/error')
const BW_LIST_ARGS_DEFAULT = ''
const CACHE_PASSWORD_DEFAULT = 15
@ -80,8 +80,8 @@ const pipeErrorToCommand = (command, e) =>
new Promise((resolve, reject) => {
const errorCommand = exec(onErrorCommand)
console.log(e)
return
errorCommand.stdin.write(`'${e.toString()}'`)
if (e instanceof CommandError) errorCommand.stdin.write(`'${e.errorMessage}'`)
else errorCommand.stdin.write(`'${e.toString()}'`)
errorCommand.stdin.end()
errorCommand.on('close', status => {
if (status === 0) resolve()


+ 6
- 6
package-lock.json View File

@ -570,9 +570,9 @@
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"lodash.sortby": {
"version": "4.7.0",
@ -728,9 +728,9 @@
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
},
"prettier": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz",
"integrity": "sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==",
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
"dev": true
},
"pseudomap": {


+ 1
- 1
package.json View File

@ -31,6 +31,6 @@
"node": ">=8"
},
"devDependencies": {
"prettier": "^1.17.0"
"prettier": "^1.18.2"
}
}

+ 4
- 0
src/util/error.js View File

@ -7,6 +7,10 @@ class CommandError extends Error {
this.stderr = stderr ? stderr.toString().trim() : ''
this.commandProcess = commandProcess
}
get errorMessage() {
return this.stdout || this.stderr || this.message
}
}
/**


Loading…
Cancel
Save