Improve error handling on premature device disconnect #86
Conversation
I think I'm missing something, but this only addresses Windows, right? |
|
||
// Test whether the device is accessible, | ||
// and if not – throw – rejecting the promise | ||
fs.accessSync(device, fs.constants.R_OK | fs.constants.W_OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we make this async?
// Test whether the device is accessible, | ||
// and if not – throw – rejecting the promise | ||
fs.accessSync(device, fs.constants.R_OK | fs.constants.W_OK); | ||
|
||
return retry(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice that in the case of balena-io/etcher#1127, we have to check the drive exists inside the retry block, otherwise we catch an initial inconsistency, but if the drive gets removed in between two tries, the error still appears.
No no, you're not missing anything, I just whipped this branch up so I can start testing it on Windows, because I wrote it on a different machine – hence the |
Ah, I see :) Cool, let me know once this reaches a reviewable state :) |
What's the status of this PR now? Has it been partially superseded by @jviotti 's other recent changes? |
Connects to:
Changes:
no-bitwise
eslint rule, as bitmasks couldn't be used otherwisediskpart
To do:
ENXIO
,ENOENT
,EIO
, ...)