summaryrefslogtreecommitdiff
path: root/cli/cache/deno_dir.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/cache/deno_dir.rs')
-rw-r--r--cli/cache/deno_dir.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/cli/cache/deno_dir.rs b/cli/cache/deno_dir.rs
index 86f3e00b5..2cee0e7a7 100644
--- a/cli/cache/deno_dir.rs
+++ b/cli/cache/deno_dir.rs
@@ -2,6 +2,7 @@
use super::DiskCache;
+use std::env;
use std::path::PathBuf;
/// `DenoDir` serves as coordinator for multiple `DiskCache`s containing them
@@ -109,8 +110,17 @@ impl DenoDir {
}
/// Path used for the REPL history file.
- pub fn repl_history_file_path(&self) -> PathBuf {
- self.root.join("deno_history.txt")
+ /// Can be overridden or disabled by setting `DENO_REPL_HISTORY` environment variable.
+ pub fn repl_history_file_path(&self) -> Option<PathBuf> {
+ if let Some(deno_repl_history) = env::var_os("DENO_REPL_HISTORY") {
+ if deno_repl_history.is_empty() {
+ None
+ } else {
+ Some(PathBuf::from(deno_repl_history))
+ }
+ } else {
+ Some(self.root.join("deno_history.txt"))
+ }
}
/// Folder path used for downloading new versions of deno.