File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/com/nordstrom/common/file Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 3
3
import java .io .BufferedReader ;
4
4
import java .io .File ;
5
5
import java .io .IOException ;
6
+ import java .io .InputStream ;
6
7
import java .io .InputStreamReader ;
7
8
import java .util .HashMap ;
8
9
import java .util .Map ;
@@ -20,18 +21,21 @@ private VolumeInfo() {
20
21
}
21
22
22
23
public static Map <String , VolumeProps > getVolumeProps () throws IOException {
23
- Map <String , VolumeProps > propsList = new HashMap <>();
24
- Pattern template = Pattern .compile ("(.+) on (.+) type (.+) \\ ((.+)\\ )" );
25
-
26
24
Process mountProcess ;
27
25
if (IS_WINDOWS ) {
28
26
String [] cmd = {"sh" , "-c" , "mount | grep noumount" };
29
27
mountProcess = Runtime .getRuntime ().exec (cmd );
30
28
} else {
31
29
mountProcess = Runtime .getRuntime ().exec ("mount" );
32
30
}
31
+ return getVolumeProps (mountProcess .getInputStream ());
32
+ }
33
+
34
+ public static Map <String , VolumeProps > getVolumeProps (InputStream is ) throws IOException {
35
+ Map <String , VolumeProps > propsList = new HashMap <>();
36
+ Pattern template = Pattern .compile ("(.+) on (.+) type (.+) \\ ((.+)\\ )" );
33
37
34
- InputStreamReader isr = new InputStreamReader (mountProcess . getInputStream () );
38
+ InputStreamReader isr = new InputStreamReader (is );
35
39
try (BufferedReader mountOutput = new BufferedReader (isr )) {
36
40
String line ;
37
41
while (null != (line = mountOutput .readLine ())) {
You can’t perform that action at this time.
0 commit comments