File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -308,6 +308,7 @@ dec Os.TraverseDir : [Os.Path] Result<Os.Error, recursive either {
308308 .dir(Os.Path, self) self,
309309}>
310310
311+ dec Os.Env : List<(Bytes) Bytes>
311312
312313/// Url
313314
Original file line number Diff line number Diff line change @@ -156,6 +156,15 @@ pub fn external_module() -> Module<std::sync::Arc<process::Expression<()>>> {
156156 ) ,
157157 |handle| Box :: pin( os_traverse_dir( handle) ) ,
158158 ) ,
159+ Definition :: external(
160+ "Env" ,
161+ Type :: name(
162+ Some ( "List" ) ,
163+ "List" ,
164+ vec![ Type :: pair( Type :: bytes( ) , Type :: bytes( ) ) ] ,
165+ ) ,
166+ |handle| Box :: pin( os_env( handle) ) ,
167+ ) ,
159168 ] ,
160169 }
161170}
@@ -565,6 +574,17 @@ async fn os_traverse_dir(mut handle: Handle) {
565574 }
566575}
567576
577+ async fn os_env ( mut handle : Handle ) {
578+ for ( name, value) in std:: env:: vars_os ( ) {
579+ handle. signal ( literal ! ( "item" ) ) ;
580+ let mut pair = handle. send ( ) ;
581+ pair. send ( ) . provide_bytes ( os_to_bytes ( & name) ) ;
582+ pair. provide_bytes ( os_to_bytes ( & value) ) ;
583+ }
584+ handle. signal ( literal ! ( "end" ) ) ;
585+ handle. break_ ( ) ;
586+ }
587+
568588async fn pathbuf_from_os_path ( mut handle : Handle ) -> PathBuf {
569589 handle. signal ( literal ! ( "absolute" ) ) ;
570590 let path_bytes = handle. bytes ( ) . await ;
You can’t perform that action at this time.
0 commit comments