fix: mount and unmount command not properly throwing errors
This commit is contained in:
parent
b86081b2e8
commit
31da747c2d
2 changed files with 11 additions and 1 deletions
|
|
@ -19,7 +19,9 @@ export class CleanupDanglingMountsJob extends Job {
|
|||
const matchingVolume = allVolumes.find((v) => getVolumePath(v) === mount.mountPoint);
|
||||
if (!matchingVolume) {
|
||||
logger.info(`Found dangling mount at ${mount.mountPoint}, attempting to unmount...`);
|
||||
await executeUnmount(mount.mountPoint);
|
||||
await executeUnmount(mount.mountPoint).catch((err) => {
|
||||
logger.warn(`Failed to unmount dangling mount ${mount.mountPoint}: ${toMessage(err)}`);
|
||||
});
|
||||
|
||||
await fs.rmdir(path.dirname(mount.mountPoint)).catch((err) => {
|
||||
logger.warn(
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ export const executeMount = async (args: string[]): Promise<void> => {
|
|||
if (stderr?.trim()) {
|
||||
logger.warn(stderr.trim());
|
||||
}
|
||||
|
||||
if (result.exitCode !== 0) {
|
||||
throw new Error(`Mount command failed with exit code ${result.exitCode}: ${stderr?.trim()}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const executeUnmount = async (path: string): Promise<void> => {
|
||||
|
|
@ -24,6 +28,10 @@ export const executeUnmount = async (path: string): Promise<void> => {
|
|||
if (stderr?.trim()) {
|
||||
logger.warn(stderr.trim());
|
||||
}
|
||||
|
||||
if (result.exitCode !== 0) {
|
||||
throw new Error(`Mount command failed with exit code ${result.exitCode}: ${stderr?.trim()}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const createTestFile = async (path: string): Promise<void> => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue