Skip to content

Commit af56495

Browse files
committed
fix: update command
1 parent 7f1d2af commit af56495

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict'
22

3-
const { dirname, basename } = require('node:path')
4-
53
const dargs = require('dargs')
64
const $ = require('tinyspawn')
75

@@ -12,7 +10,9 @@ const args = (flags = {}) => dargs(flags, { useEquals: false }).filter(Boolean)
1210
const isJSON = (str = '') => str.startsWith('{')
1311

1412
const parse = ({ stdout, stderr, ...details }) => {
15-
if (details.exitCode === 0) { return isJSON(stdout) ? JSON.parse(stdout) : stdout }
13+
if (details.exitCode === 0) {
14+
return isJSON(stdout) ? JSON.parse(stdout) : stdout
15+
}
1616
throw Object.assign(new Error(stderr), { stderr, stdout }, details)
1717
}
1818

@@ -26,9 +26,7 @@ const create = binaryPath => {
2626
return fn
2727
}
2828

29-
const update = (binaryPath = constants.YOUTUBE_DL_PATH) => {
30-
return $(basename(binaryPath), ['-U'], { cwd: dirname(binaryPath) })
31-
}
29+
const update = (binaryPath = constants.YOUTUBE_DL_PATH) => $(binaryPath, ['-U'])
3230

3331
const defaultInstance = create(constants.YOUTUBE_DL_PATH)
3432

0 commit comments

Comments
 (0)