Closed rsinet closed 4 years ago
Hi. The app we use runs in Linux which has sudoers and other which has not. Thats why. You can try sudo if the one before was unsuccessful, but when it fails it doesnt throw an exception.
Em qua, 23 de set de 2020 09:04, Samuel Campos notifications@github.com escreveu:
@samuelcampos commented on this pull request.
In src/main/java/net/samuelcampos/usbdrivedetector/unmounters/LinuxStorageDeviceUnmounter.java https://github.com/samuelcampos/usbdrivedetector/pull/26#discussion_r360742843 :
- try {
- unmount("umount " + usbStorageDevice.getDevice());
- } catch (IOException e) {
- unmount("sudo umount " + usbStorageDevice.getDevice());
- }
- }
- private void unmount(String command) throws IOException {
- try (CommandExecutor commandExecutor = new CommandExecutor(command)) {
- // Some times you need to wait until it is fully unmounted
- Thread.sleep(1000L);
- } catch (InterruptedException e) {
- log.error("Unable to unmount device", e);
- }
- unmount("umount " + usbStorageDevice.getDevice());
- unmount("sudo umount " + usbStorageDevice.getDevice());
Why do you need to always try twice? Is it possible to use sudo when the previous command was unsuccessful?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/samuelcampos/usbdrivedetector/pull/26#pullrequestreview-335683537, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5A2UY4RVWLXNYL7YQZNOTSHHP3NANCNFSM4JTAGC6A .
Hey man. Can you check this Merge Request ? It has taking too long