diff --git a/lib/cli/writer.js b/lib/cli/writer.js index 103c0d43..173d7dcb 100644 --- a/lib/cli/writer.js +++ b/lib/cli/writer.js @@ -75,7 +75,15 @@ exports.writeImage = (imagePath, drive, options, onProgress) => { }).then(() => { return diskpart.clean(drive.device) }).then(() => { - return fs.openAsync(drive.raw, 'rs+') + /* eslint-disable no-bitwise */ + const flags = fs.constants.O_RDWR | + fs.constants.O_EXCL | + fs.constants.O_NONBLOCK | + fs.constants.O_SYNC | + fs.constants.O_DIRECT + /* eslint-enable no-bitwise */ + + return fs.openAsync(drive.raw, flags) }).then((driveFileDescriptor) => { return imageStream.getFromFilePath(imagePath).then((image) => { if (!constraints.isDriveLargeEnough(drive, image)) {