@@ -1002,20 +1002,18 @@ impl Devenv {
1002
1002
}
1003
1003
util:: write_file_with_lock (
1004
1004
self . devenv_dotfile . join ( "flake.json" ) ,
1005
- & serde_json:: to_string ( & flake_inputs) . unwrap ( ) ,
1005
+ serde_json:: to_string ( & flake_inputs) . unwrap ( ) ,
1006
1006
) ?;
1007
- fs :: write (
1007
+ util :: write_file_with_lock (
1008
1008
self . devenv_dotfile . join ( "devenv.json" ) ,
1009
1009
serde_json:: to_string ( & self . config ) . unwrap ( ) ,
1010
- )
1011
- . expect ( "Failed to write devenv.json" ) ;
1010
+ ) ?;
1012
1011
// TODO: superceded by eval caching.
1013
1012
// Remove once direnvrc migration is implemented.
1014
- fs :: write (
1013
+ util :: write_file_with_lock (
1015
1014
self . devenv_dotfile . join ( "imports.txt" ) ,
1016
1015
self . config . imports . join ( "\n " ) ,
1017
- )
1018
- . expect ( "Failed to write imports.txt" ) ;
1016
+ ) ?;
1019
1017
1020
1018
fs:: create_dir_all ( & self . devenv_runtime ) . map_err ( |e| {
1021
1019
miette:: miette!( "Failed to create {}: {}" , self . devenv_runtime. display( ) , e)
@@ -1066,8 +1064,7 @@ impl Devenv {
1066
1064
1067
1065
cli_options. push_str ( "}\n " ) ;
1068
1066
1069
- fs:: write ( self . devenv_dotfile . join ( "cli-options.nix" ) , cli_options)
1070
- . expect ( "Failed to write cli-options.nix" ) ;
1067
+ util:: write_file_with_lock ( self . devenv_dotfile . join ( "cli-options.nix" ) , & cli_options) ?;
1071
1068
} else {
1072
1069
// Remove the file if it exists but there are no CLI options
1073
1070
let cli_options_path = self . devenv_dotfile . join ( "cli-options.nix" ) ;
@@ -1120,7 +1117,7 @@ impl Devenv {
1120
1117
let env = self . nix . dev_env ( json, & gc_root) . instrument ( span) . await ?;
1121
1118
1122
1119
use devenv_eval_cache:: command:: { FileInputDesc , Input } ;
1123
- fs :: write (
1120
+ util :: write_file_with_lock (
1124
1121
self . devenv_dotfile . join ( "input-paths.txt" ) ,
1125
1122
env. inputs
1126
1123
. iter ( )
@@ -1139,8 +1136,7 @@ impl Devenv {
1139
1136
} )
1140
1137
. collect :: < Vec < _ > > ( )
1141
1138
. join ( "\n " ) ,
1142
- )
1143
- . expect ( "Failed to write input-paths.txt" ) ;
1139
+ ) ?;
1144
1140
1145
1141
Ok ( DevEnv { output : env. stdout } )
1146
1142
}
0 commit comments