Skip to content

Commit

Permalink
Replace p-finally with promise.finally()
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 22, 2019
1 parent c33ddaa commit 4f1e798
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"nvexeca": "^1.7.0",
"omit.js": "^1.0.2",
"os-name": "^3.1.0",
"p-finally": "^2.0.1",
"p-map-series": "^2.1.0",
"path-exists": "^4.0.0",
"precise-now": "^0.1.2",
Expand Down
12 changes: 5 additions & 7 deletions src/run.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pMapSeries from 'p-map-series'
import pFinally from 'p-finally'

import { startProgress } from './progress/start.js'
import { stopProgress } from './progress/stop.js'
Expand All @@ -13,12 +12,11 @@ export const runBenchmark = async function(opts) {

const { progressState, progressInfo } = await startProgress(iterations, opts)

// TODO: replace with `try {} finally {}` when dropping support for Node 8/9
const rawBenchmark = await pFinally(
computeBenchmark({ iterations, progressState, opts, versions }),
() => stopProgress(progressInfo),
)
return rawBenchmark
try {
return await computeBenchmark({ iterations, progressState, opts, versions })
} finally {
await stopProgress(progressInfo)
}
}

const computeBenchmark = async function({
Expand Down

0 comments on commit 4f1e798

Please sign in to comment.