You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
562 B
JavaScript
17 lines
562 B
JavaScript
"use strict";
|
|
|
|
const { errorResult } = require("../../text-parser");
|
|
const createRegexParser = require("../../text-parser-regex");
|
|
|
|
const errors = require("../errors");
|
|
|
|
module.exports = function (devicePath, action) {
|
|
return function handlePartitionExists(command) {
|
|
return command.expectOnStderr(createRegexParser(/WARNING: [a-z]+ signature detected on/, () => {
|
|
return errorResult(new errors.PartitionExists(`Refused to ${action}, as a partition or partition table already exists on device '${devicePath}'`, {
|
|
path: devicePath
|
|
}));
|
|
}));
|
|
};
|
|
};
|