fix(xo-server/backupNg): await writeStream (#2951)

This commit is contained in:
Julien Fontanet 2018-05-16 10:32:38 +02:00 committed by GitHub
parent ebbd882ee4
commit fcec8113f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ import {
noop,
values,
} from 'lodash'
import { timeout as pTimeout } from 'promise-toolbox'
import { fromEvent as pFromEvent, timeout as pTimeout } from 'promise-toolbox'
import Vhd, {
chainVhd,
createSyntheticStream as createVhdReadStream,
@ -304,6 +304,7 @@ const writeStream = async (
const output = await handler.createOutputStream(tmpPath, { checksum })
try {
input.pipe(output)
await pFromEvent(output, 'finish')
await output.checksumWritten
// $FlowFixMe
await input.task