File tree Expand file tree Collapse file tree 2 files changed +29
-6
lines changed
Expand file tree Collapse file tree 2 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -165,18 +165,19 @@ impl Sandboxer for RuncSandboxer {
165165 let mut sandbox = sandbox. lock ( ) . await ;
166166 let mut sandbox_parent = self . sandbox_parent . lock ( ) . await ;
167167 let sandbox_pid = sandbox_parent. fork_sandbox_process ( id, & sandbox. data . netns ) ?;
168- sandbox. prepare_sandbox_ns ( sandbox_pid) . await . map_err ( |e| {
169- kill ( Pid :: from_raw ( sandbox_pid) , Signal :: SIGKILL ) . unwrap_or_default ( ) ;
170- e
171- } ) ?;
168+ sandbox
169+ . prepare_sandbox_ns ( sandbox_pid)
170+ . await
171+ . inspect_err ( |_| {
172+ kill ( Pid :: from_raw ( sandbox_pid) , Signal :: SIGKILL ) . unwrap_or_default ( ) ;
173+ } ) ?;
172174
173175 sandbox
174176 . data
175177 . task_address
176178 . clone_from ( & format ! ( "ttrpc+{}" , self . task_address) ) ;
177- sandbox. dump ( ) . await . map_err ( |e | {
179+ sandbox. dump ( ) . await . inspect_err ( |_ | {
178180 kill ( Pid :: from_raw ( sandbox_pid) , Signal :: SIGKILL ) . unwrap_or_default ( ) ;
179- e
180181 } ) ?;
181182 Ok ( ( ) )
182183 }
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ use std:: fs;
18+
1719use ttrpc_codegen:: { Codegen , Customize , ProtobufCustomize } ;
1820
1921fn main ( ) {
@@ -45,4 +47,24 @@ fn main() {
4547 )
4648 . run ( )
4749 . expect ( "Gen protos code failed" ) ;
50+
51+ // Protobuf-rust 3.5.1 no longer generates the `#![allow(box_pointers)]` lint.
52+ // However, ttrpc-rust has not yet upgraded to protobuf-rust 3.5.1.
53+ // As a temporary measure, we are modifying the files to suppress the warning.
54+ remove_box_pointers ( "src/api" ) . expect ( "Remove api box_pointer failed" ) ;
55+ }
56+
57+ fn remove_box_pointers ( dir : & str ) -> std:: io:: Result < ( ) > {
58+ for entry in fs:: read_dir ( dir) ? {
59+ let entry = entry?;
60+ let path = entry. path ( ) ;
61+
62+ if path. is_file ( ) {
63+ let content = fs:: read_to_string ( & path) ?;
64+ let new_content = content. replace ( "#![allow(box_pointers)]" , "" ) ;
65+
66+ fs:: write ( path, new_content) ?;
67+ }
68+ }
69+ Ok ( ( ) )
4870}
You can’t perform that action at this time.
0 commit comments