Skip to content

Commit

Permalink
🐛 Fix: output empty after uploading when using isolate context
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed May 9, 2021
1 parent a0fbe68 commit 79c228b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/core/Lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ class Lifecycle extends EventEmitter {
let msg = ''
const length = ctx.output.length
for (let i = 0; i < length; i++) {
msg += handleUrlEncode(ctx.output[i].imgUrl)
if (i !== length - 1) {
msg += '\n'
if (typeof ctx.output[i].imgUrl !== 'undefined') {
msg += handleUrlEncode(ctx.output[i].imgUrl!)
if (i !== length - 1) {
msg += '\n'
}
}
delete ctx.output[i].base64Image
delete ctx.output[i].buffer
Expand Down
8 changes: 4 additions & 4 deletions src/core/PicGo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ class PicGo extends EventEmitter implements IPicGo {
fs.remove(imgPath).catch((e) => { this.log.error(e) })
}
})
await this.lifecycle.start([imgPath])
return this.output
const { output } = await this.lifecycle.start([imgPath])
return output
}
} catch (e) {
this.emit(IBuildInEvent.FAILED, e)
throw e
}
} else {
// upload from path
await this.lifecycle.start(input)
return this.output
const { output } = await this.lifecycle.start(input)
return output
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ interface IImgInfo {
width?: number
height?: number
extname?: string
imgUrl?: string
[propName: string]: any
}

Expand Down

0 comments on commit 79c228b

Please sign in to comment.