Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly parse arguments for list --is-pack #194

Merged
merged 1 commit into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions bin/asar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ program.command('list <archive>')
for (var i in files) {
console.log(files[i])
}
// This is in order to disappear help
process.exit(0)
})

program.command('extract-file <archive> <filename>')
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"chromium-pickle-js": "^0.2.0",
"commander": "^4.1.1",
"commander": "^5.0.0",
"glob": "^7.1.6",
"minimatch": "^3.0.4"
},
Expand Down
6 changes: 3 additions & 3 deletions test/cli-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const compDirs = require('./util/compareDirectories')
const compFileLists = require('./util/compareFileLists')
const compFiles = require('./util/compareFiles')

childProcess.exec = promisify(childProcess.exec)
const exec = promisify(childProcess.exec)

async function execAsar (args) {
return childProcess.exec(`node bin/asar ${args}`)
return exec(`node bin/asar ${args}`)
}

async function assertAsarOutputMatches (args, expectedFilename) {
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('command line interface', function () {
return assertAsarOutputMatches('l test/expected/packthis-unpack-dir.asar', 'test/expected/extractthis-filelist.txt')
})
it('should list files/dirs in archive with unpacked dirs & is-pack option', async () => {
return assertAsarOutputMatches('l test/expected/packthis-unpack-dir.asar --is-pack', 'test/expected/extractthis-filelist-with-option.txt')
return assertAsarOutputMatches('l --is-pack test/expected/packthis-unpack-dir.asar', 'test/expected/extractthis-filelist-with-option.txt')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapping the position of the flag shows the bug with commander 4.x.

})
it('should extract an archive with unpacked dirs', async () => {
await execAsar('e test/input/extractthis-unpack-dir.asar tmp/extractthis-unpack-dir/')
Expand Down