File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ fn pid() {
3838 . pid_file ( & path)
3939 . sleep ( std:: time:: Duration :: from_secs ( 5 ) )
4040 . run ( ) ;
41- let pid = std:: fs:: read_to_string ( & path) . unwrap ( ) . parse ( ) . unwrap ( ) ;
41+ let pid_content = std:: fs:: read_to_string ( & path) . unwrap ( ) ;
42+ assert ! ( pid_content. ends_with( '\n' ) ) ;
43+ let pid = pid_content[ ..pid_content. len ( ) - 1 ] . parse ( ) . unwrap ( ) ;
4244 assert_eq ! ( result. unwrap( ) . pid, pid) ;
4345
4446 let result = Tester :: new ( ) . pid_file ( & path) . run ( ) ;
Original file line number Diff line number Diff line change @@ -537,7 +537,7 @@ unsafe fn chown_pid_file(
537537
538538unsafe fn write_pid_file ( fd : libc:: c_int ) -> Result < ( ) , ErrorKind > {
539539 let pid = libc:: getpid ( ) ;
540- let pid_buf = format ! ( "{}" , pid) . into_bytes ( ) ;
540+ let pid_buf = format ! ( "{}\n " , pid) . into_bytes ( ) ;
541541 let pid_length = pid_buf. len ( ) ;
542542 let pid_c = CString :: new ( pid_buf) . unwrap ( ) ;
543543 check_err ( libc:: ftruncate ( fd, 0 ) , ErrorKind :: TruncatePidfile ) ?;
You can’t perform that action at this time.
0 commit comments