Skip to content

Commit f77661e

Browse files
committed
Add permission check before configuration
1 parent dafca3f commit f77661e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pip/_internal/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ def save(self) -> None:
211211
ensure_dir(os.path.dirname(fname))
212212

213213
# Ensure directory's permission(need to be writeable)
214-
if os.access(fname, os.W_OK):
214+
try:
215215
with open(fname, "w") as f:
216216
parser.write(f)
217-
else:
217+
except:
218218
raise ConfigurationError(
219219
"Configuation file not writeable {}".format(': '.join(fname))
220220
)

0 commit comments

Comments
 (0)