@@ -337,8 +337,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
337
337
Err ( e) => this. set_last_error_from_io_error ( e) ?,
338
338
}
339
339
} else {
340
- // Emulate an error in isolation mode
341
- let err = Error :: new ( ErrorKind :: NotFound , "`getcwd` not available in isolation mode" ) ;
340
+ // Return a dummy error in isolation mode, after printing a warning about it.
341
+ this. warn_foreign_in_isolation ( "getcwd" ) ;
342
+ let err = Error :: new ( ErrorKind :: NotFound , "dummy error in isolation mode" ) ;
342
343
this. set_last_error_from_io_error ( err) ?;
343
344
}
344
345
Ok ( Scalar :: null_ptr ( & * this. tcx ) )
@@ -364,8 +365,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
364
365
Err ( e) => this. set_last_error_from_io_error ( e) ?,
365
366
}
366
367
} else {
367
- // Emulate an error in isolation mode
368
- let err = Error :: new ( ErrorKind :: NotFound , "`GetCurrentDirectoryW` not available in isolation mode" ) ;
368
+ // Return a dummy error in isolation mode, after printing a warning about it.
369
+ this. warn_foreign_in_isolation ( "GetCurrentDirectoryW" ) ;
370
+ let err = Error :: new ( ErrorKind :: NotFound , "dummy error in isolation mode" ) ;
369
371
this. set_last_error_from_io_error ( err) ?;
370
372
}
371
373
Ok ( 0 )
@@ -390,9 +392,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
390
392
}
391
393
}
392
394
} else {
393
- // Emulate an error in isolation mode
394
- let err = Error :: new ( ErrorKind :: NotFound , "`chdir` not available in isolation mode" ) ;
395
+ // Return a dummy error in isolation mode, after printing a warning about it.
396
+ this. warn_foreign_in_isolation ( "chdir" ) ;
397
+ let err = Error :: new ( ErrorKind :: NotFound , "dummy error in isolation mode" ) ;
395
398
this. set_last_error_from_io_error ( err) ?;
399
+
396
400
Ok ( -1 )
397
401
}
398
402
}
@@ -418,8 +422,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
418
422
}
419
423
}
420
424
} else {
421
- // Emulate an error in isolation mode
422
- let err = Error :: new ( ErrorKind :: NotFound , "`SetCurrentDirectoryW` not available in isolation mode" ) ;
425
+ // Return a dummy error in isolation mode, after printing a warning about it.
426
+ this. warn_foreign_in_isolation ( "SetCurrentDirectoryW" ) ;
427
+ let err = Error :: new ( ErrorKind :: NotFound , "dummy error in isolation mode" ) ;
423
428
this. set_last_error_from_io_error ( err) ?;
424
429
Ok ( 0 )
425
430
}
0 commit comments