summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 08:01:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 08:02:05 +0000
commit58eb230a3998a0224ff264095ee157e3e2e2f5ce (patch)
treef454f7ad668faaab4f49679b69e9b5416c18db0d
parentReleasing debian version 1.10.0-1. (diff)
downloadlitecli-58eb230a3998a0224ff264095ee157e3e2e2f5ce.tar.xz
litecli-58eb230a3998a0224ff264095ee157e3e2e2f5ce.zip
Merging upstream version 1.10.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--CHANGELOG.md7
-rw-r--r--litecli/__init__.py2
-rw-r--r--litecli/config.py6
-rw-r--r--litecli/main.py6
4 files changed, 18 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 808b8df..edee1e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 1.10.1 - 2024-3-23
+
+### Bug Fixes
+
+* Do not crash at start up if ~/.config/litecli is not writeable. [#172](https://github.com/dbcli/litecli/issues/172)
+
+
## 1.10.0 - 2022-11-19
### Features
diff --git a/litecli/__init__.py b/litecli/__init__.py
index fcfdf38..a0865bb 100644
--- a/litecli/__init__.py
+++ b/litecli/__init__.py
@@ -1 +1 @@
-__version__ = "1.10.0"
+__version__ = "1.10.1"
diff --git a/litecli/config.py b/litecli/config.py
index 1c7fb25..55d3e32 100644
--- a/litecli/config.py
+++ b/litecli/config.py
@@ -57,6 +57,10 @@ def get_config(liteclirc_file=None):
liteclirc_file = liteclirc_file or "%sconfig" % config_location()
default_config = os.path.join(package_root, "liteclirc")
- write_default_config(default_config, liteclirc_file)
+ try:
+ write_default_config(default_config, liteclirc_file)
+ except OSError:
+ # If we can't write to the config file, just use the default config
+ return load_config(default_config)
return load_config(liteclirc_file, default_config)
diff --git a/litecli/main.py b/litecli/main.py
index e608da7..268ede2 100644
--- a/litecli/main.py
+++ b/litecli/main.py
@@ -239,7 +239,11 @@ class LiteCli(object):
log_file = self.config["main"]["log_file"]
if log_file == "default":
log_file = config_location() + "log"
- ensure_dir_exists(log_file)
+ try:
+ ensure_dir_exists(log_file)
+ except OSError:
+ # Unable to create log file, log to temp directory instead.
+ log_file = "/tmp/litecli.log"
log_level = self.config["main"]["log_level"]