Write shebang recipes to $XDG_RUNTIME_DIR (#2128)

This commit is contained in:
Casey Rodarmor 2024-06-05 21:03:14 +02:00 committed by GitHub
parent 7c30fb4944
commit af249dbce1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ pub(crate) enum Error<'src> {
token: Token<'src>,
output_error: OutputError,
},
CacheDirIo {
RuntimeDirIo {
io_error: io::Error,
path: PathBuf,
},
@ -287,9 +287,6 @@ impl<'src> ColorDisplay for Error<'src> {
}?,
OutputError::Utf8(utf8_error) => write!(f, "Backtick succeeded but stdout was not utf8: {utf8_error}")?,
}
CacheDirIo { io_error, path } => {
write!(f, "I/O error in cache dir `{}`: {io_error}", path.display())?;
}
ChooserInvoke { shell_binary, shell_arguments, chooser, io_error} => {
let chooser = chooser.to_string_lossy();
write!(f, "Chooser `{shell_binary} {shell_arguments} {chooser}` invocation failed: {io_error}")?;
@ -407,6 +404,9 @@ impl<'src> ColorDisplay for Error<'src> {
write!(f, "Recipe `{recipe}` was not confirmed")?;
}
RegexCompile { source } => write!(f, "{source}")?,
RuntimeDirIo { io_error, path } => {
write!(f, "I/O error in runtime dir `{}`: {io_error}", path.display())?;
}
Search { search_error } => Display::fmt(search_error, f)?,
Shebang { recipe, command, argument, io_error} => {
if let Some(argument) = argument {

View File

@ -353,9 +353,9 @@ impl<'src, D> Recipe<'src, D> {
let tempdir = match &context.settings.tempdir {
Some(tempdir) => tempdir_builder.tempdir_in(context.search.working_directory.join(tempdir)),
None => {
if let Some(cache_dir) = dirs::cache_dir() {
let path = cache_dir.join("just");
fs::create_dir_all(&path).map_err(|io_error| Error::CacheDirIo {
if let Some(runtime_dir) = dirs::runtime_dir() {
let path = runtime_dir.join("just");
fs::create_dir_all(&path).map_err(|io_error| Error::RuntimeDirIo {
io_error,
path: path.clone(),
})?;

View File

@ -5,8 +5,8 @@ pub(crate) fn tempdir() -> TempDir {
builder.prefix("just-test-tempdir");
if let Some(cache_dir) = dirs::cache_dir() {
let path = cache_dir.join("just");
if let Some(runtime_dir) = dirs::runtime_dir() {
let path = runtime_dir.join("just");
fs::create_dir_all(&path).unwrap();
builder.tempdir_in(path)
} else {