Skip to content

Commit

Permalink
fix: synchronously check for path exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 19, 2018
1 parent 6628759 commit 357ea6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class UpdateCommand extends Command {
const {version, channel} = manifest
cli.action.start(`${this.config.name}: Updating CLI from ${color.green(this.config.version)} to ${color.green(version)}${channel === 'stable' ? '' : ' (' + color.yellow(channel) + ')'}`)
const http: typeof HTTP = require('http-call').HTTP
const filesize = require('filesize')
const filesize = require('filesize').partial({unix: true})
const output = path.join(this.clientRoot, version)

const {response: stream} = await http.stream(manifest.gz)
Expand Down
2 changes: 1 addition & 1 deletion src/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const debug = require('debug')('oclif-update')
export async function extract(stream: NodeJS.ReadableStream, basename: string, output: string, sha?: string) {
const getTmp = () => `${output}.partial.${Math.random().toString().split('.')[1].slice(0, 5)}`
let tmp = getTmp()
if (await fs.pathExists(tmp)) tmp = getTmp()
if (fs.pathExistsSync(tmp)) tmp = getTmp()
debug(`extracting to ${tmp}`)
try {
await new Promise((resolve, reject) => {
Expand Down

0 comments on commit 357ea6f

Please sign in to comment.