File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1103,3 +1103,22 @@ fn test_tasks() {
1103
1103
} ) ;
1104
1104
scheduler. join ( ) . expect ( "Scheduler panicked" ) ;
1105
1105
}
1106
+
1107
+ #[ test]
1108
+ fn open_files ( ) {
1109
+ if !sysinfo:: IS_SUPPORTED_SYSTEM || cfg ! ( feature = "apple-sandbox" ) {
1110
+ return ;
1111
+ }
1112
+ let pid = sysinfo:: get_current_pid ( ) . expect ( "failed to get current pid" ) ;
1113
+ let _file =
1114
+ std:: fs:: File :: create ( std:: env:: temp_dir ( ) . join ( "sysinfo-open-files.test" ) ) . unwrap ( ) ;
1115
+ let mut s = System :: new ( ) ;
1116
+ s. refresh_processes ( ProcessesToUpdate :: Some ( & [ pid] ) , false ) ;
1117
+ let cur_process = s. process ( pid) . unwrap ( ) ;
1118
+ assert ! ( cur_process
1119
+ . open_files( )
1120
+ . is_some_and( |open_files| open_files > 0 ) ) ;
1121
+ assert ! ( cur_process
1122
+ . open_files_limit( )
1123
+ . is_some_and( |open_files| open_files > 0 ) ) ;
1124
+ }
You can’t perform that action at this time.
0 commit comments