@@ -32,6 +32,7 @@ pub fn help() -> String{
32
32
cat View file only read mv Move file's path
33
33
python Run code in python tar -zxvf: Compression
34
34
html Open html file tar -xvf: Decompression
35
+ pd Check your password sudo Root
35
36
exit Exit this process\0 \x1B [0m\n "
36
37
) ;
37
38
@@ -300,18 +301,26 @@ pub fn cat(file: &str) -> Result<(usize,String),Error>{
300
301
if file. is_empty ( ) {
301
302
return Ok ( empty_file ( ) ) ;
302
303
}
303
- let f = fs:: File :: open ( Path :: new ( file) ) ;
304
304
let mut buffer = String :: new ( ) ;
305
- let _ = f. unwrap ( ) . read_to_string ( & mut buffer) ;
305
+ let file_size = max_size_file ( file) ;
306
+ match file_size{
307
+ Ok ( _) =>{
308
+ let f = fs:: File :: open ( Path :: new ( file) ) ;
309
+ let _ = f. unwrap ( ) . read_to_string ( & mut buffer) ;
310
+ } ,
311
+ Err ( err) =>{
312
+ return Ok ( ( ERR_CODE , err. to_string ( ) ) ) ;
313
+ }
314
+ }
306
315
Ok ( ( STATUE_CODE , buffer) )
307
316
}
308
317
309
318
310
319
use crate :: commands:: download:: { download_package, find_package} ;
311
320
use crate :: priority:: get_priority;
312
- use crate :: set:: set:: file_create_time;
321
+ use crate :: set:: set:: { file_create_time, max_size_file } ;
313
322
use crate :: run:: run;
314
- use crate :: state_code:: { empty_dir, empty_file, missing_pattern, STATUE_CODE } ;
323
+ use crate :: state_code:: { empty_dir, empty_file, missing_pattern, ERR_CODE , STATUE_CODE } ;
315
324
use super :: download:: update;
316
325
use crate :: root:: SessionContext ;
317
326
0 commit comments