Skip to content

Commit 02b638c

Browse files
committed
Download patches to temporary file
Signed-off-by: Stephen Finucane <[email protected]> Closes: #44
1 parent 31366ba commit 02b638c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

git_pw/api.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
from functools import update_wrapper
66
import logging
7+
import os.path
78
import re
89
import sys
10+
import tempfile
911

1012
import click
1113
import requests
@@ -195,7 +197,8 @@ def download(url, params=None):
195197
LOG.error('Filename was expected but was not provided in response')
196198
sys.exit(1)
197199

198-
output_path = header.group(1)
200+
output_path = os.path.join(tempfile.mkdtemp(prefix='git-pw'),
201+
header.group(1))
199202

200203
with open(output_path, 'wb') as output_file:
201204
LOG.debug('Saving to %s', output_path)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
upgrade:
3+
- |
4+
Downloaded patches, series and bundles are now saved to a temporary
5+
directory instead of the current directory.

0 commit comments

Comments
 (0)