#46: Fix Mount Manager unmount and mount detection
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
## 1.3.0
|
## 1.3.0
|
||||||
|
* \#38: Enhance new repertory release available notification
|
||||||
|
* \#46: Fix Mount Manager unmount and mount detection
|
||||||
* Skynet support
|
* Skynet support
|
||||||
* Synchronize UI major/minor version with `repertory` major/minor version
|
* Synchronize UI major/minor version with `repertory` major/minor version
|
||||||
* Added `Password` component
|
* Added `Password` component
|
||||||
@@ -10,9 +12,6 @@
|
|||||||
* Debian 9 ARM64
|
* Debian 9 ARM64
|
||||||
* Debian 10 ARM64
|
* Debian 10 ARM64
|
||||||
* Solus
|
* Solus
|
||||||
|
|
||||||
## 1.1.5
|
|
||||||
* \#38: Enhance new repertory release available notification
|
|
||||||
* Added `FocusTrap` to modals
|
* Added `FocusTrap` to modals
|
||||||
|
|
||||||
## 1.1.4
|
## 1.1.4
|
||||||
|
|||||||
105
src/helpers.js
105
src/helpers.js
@@ -62,6 +62,62 @@ const _vcRuntimeExists = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _detectRepertoryMounts = (version, providerList) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let mountState = {};
|
||||||
|
const defaultData = {};
|
||||||
|
for (const provider of providerList) {
|
||||||
|
defaultData[provider] = {
|
||||||
|
Active: false,
|
||||||
|
Location: '',
|
||||||
|
PID: -1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const grabStatus = index => {
|
||||||
|
if (index >= providerList.length) {
|
||||||
|
resolve(mountState);
|
||||||
|
} else {
|
||||||
|
const provider = providerList[index];
|
||||||
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
|
const processOptions = {
|
||||||
|
cwd: repertoryExec.working,
|
||||||
|
detached: true,
|
||||||
|
shell: false,
|
||||||
|
windowsHide: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const args = _getDefaultRepertoryArgs(provider, !Constants.PROVIDER_LIST.includes(provider));
|
||||||
|
args.push('-status');
|
||||||
|
|
||||||
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
|
let result = '';
|
||||||
|
|
||||||
|
process.on('error', (err) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
process.stdout.on('data', (d) => {
|
||||||
|
result += d;
|
||||||
|
});
|
||||||
|
|
||||||
|
process.on('exit', () => {
|
||||||
|
mountState[provider] = _tryParse(result, defaultData)[provider];
|
||||||
|
if (mountState[provider].Active &&
|
||||||
|
((mountState[provider].Location === 'elevating') || (mountState[provider].Location === ''))) {
|
||||||
|
setTimeout(() => {
|
||||||
|
grabStatus(index);
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
grabStatus(++index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
process.unref();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
grabStatus(0);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const _executeProcess = (command, working, args=[]) => {
|
const _executeProcess = (command, working, args=[]) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let processOptions = {
|
let processOptions = {
|
||||||
@@ -253,54 +309,7 @@ module.exports.createSignatureFiles = (signature, publicKey) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.detectRepertoryMounts = (version, providerList) => {
|
module.exports.detectRepertoryMounts = _detectRepertoryMounts;
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let mountState = {};
|
|
||||||
const defaultData = {};
|
|
||||||
for (const provider of providerList) {
|
|
||||||
defaultData[provider] = {
|
|
||||||
Active: false,
|
|
||||||
Location: '',
|
|
||||||
PID: -1,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const grabStatus = index => {
|
|
||||||
if (index >= providerList.length) {
|
|
||||||
resolve(mountState);
|
|
||||||
} else {
|
|
||||||
const provider = providerList[index];
|
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
|
||||||
const processOptions = {
|
|
||||||
cwd: repertoryExec.working,
|
|
||||||
detached: true,
|
|
||||||
shell: false,
|
|
||||||
windowsHide: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, !Constants.PROVIDER_LIST.includes(provider));
|
|
||||||
args.push('-status');
|
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
|
||||||
let result = '';
|
|
||||||
|
|
||||||
process.on('error', (err) => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
process.stdout.on('data', (d) => {
|
|
||||||
result += d;
|
|
||||||
});
|
|
||||||
|
|
||||||
process.on('exit', () => {
|
|
||||||
mountState[provider] = _tryParse(result, defaultData)[provider];
|
|
||||||
grabStatus(++index);
|
|
||||||
});
|
|
||||||
process.unref();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
grabStatus(0);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
|
module.exports.downloadFile = (url, destination, progressCallback, completeCallback) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user