1
- use crate :: dirs:: { CARGO_HOME , RUSTUP_HOME } ;
1
+ use crate :: dirs:: { self , CARGO_HOME , RUSTUP_HOME } ;
2
2
use crate :: docker:: DockerEnv ;
3
3
use crate :: docker:: { ContainerBuilder , MountPerms } ;
4
4
use crate :: native;
@@ -238,9 +238,7 @@ impl<'a, 'pl> SandboxedCommand<'a, 'pl> {
238
238
cmd. push (
239
239
match self . command . binary {
240
240
Binary :: Global ( path) => path,
241
- Binary :: InstalledByCrater ( path) => {
242
- PathBuf :: from ( "/opt/crater/cargo-home/bin" ) . join ( path)
243
- }
241
+ Binary :: InstalledByCrater ( path) => dirs:: container:: CARGO_BIN_DIR . join ( path) ,
244
242
}
245
243
. to_string_lossy ( )
246
244
. as_ref ( )
@@ -258,9 +256,13 @@ impl<'a, 'pl> SandboxedCommand<'a, 'pl> {
258
256
259
257
self . container = self
260
258
. container
261
- . mount ( source_dir, "/opt/crater/workdir" , MountPerms :: ReadOnly )
262
- . env ( "SOURCE_DIR" , "/opt/crater/workdir" )
263
- . workdir ( "/opt/crater/workdir" )
259
+ . mount (
260
+ source_dir,
261
+ dirs:: container:: WORK_DIR . to_str ( ) . unwrap ( ) ,
262
+ MountPerms :: ReadOnly ,
263
+ )
264
+ . env ( "SOURCE_DIR" , dirs:: container:: WORK_DIR . to_str ( ) . unwrap ( ) )
265
+ . workdir ( dirs:: container:: WORK_DIR . to_str ( ) . unwrap ( ) )
264
266
. cmd ( cmd) ;
265
267
266
268
if let Some ( user_id) = native:: current_user ( ) {
@@ -277,14 +279,21 @@ impl<'a, 'pl> SandboxedCommand<'a, 'pl> {
277
279
if self . command . local_rustup {
278
280
self . container = self
279
281
. container
280
- . mount ( & * CARGO_HOME , "/opt/crater/cargo-home" , MountPerms :: ReadOnly )
282
+ . mount (
283
+ & * CARGO_HOME ,
284
+ dirs:: container:: CARGO_HOME . to_str ( ) . unwrap ( ) ,
285
+ MountPerms :: ReadOnly ,
286
+ )
281
287
. mount (
282
288
& * RUSTUP_HOME ,
283
- "/opt/crater/rustup-home" ,
289
+ dirs :: container :: RUSTUP_HOME . to_str ( ) . unwrap ( ) ,
284
290
MountPerms :: ReadOnly ,
285
291
)
286
- . env ( "CARGO_HOME" , "/opt/crater/cargo-home" )
287
- . env ( "RUSTUP_HOME" , "/opt/crater/rustup-home" ) ;
292
+ . env ( "CARGO_HOME" , dirs:: container:: CARGO_HOME . to_str ( ) . unwrap ( ) )
293
+ . env (
294
+ "RUSTUP_HOME" ,
295
+ dirs:: container:: RUSTUP_HOME . to_str ( ) . unwrap ( ) ,
296
+ ) ;
288
297
}
289
298
290
299
self . container . run ( self . command . quiet )
0 commit comments