Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add argument for dump_out directory #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions emrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,12 @@ def do_POST(self):
# Binary file dump/upload handling. Requests to
# "stdio.html?file=filename" will write binary data to the given file.
data = self.rfile.read(int(self.headers['Content-Length']))
filename = query[len('file='):]
dump_out_directory = 'dump_out'
filename = unquote_u(query[len('file='):])
filename = os.path.join(emrun_options.dump_out_directory, os.path.normpath(filename))
try:
os.mkdir(dump_out_directory)
os.makedirs(os.path.dirname(filename))
except OSError:
pass
filename = os.path.join(dump_out_directory, os.path.normpath(filename))
open(filename, 'wb').write(data)
logi('Wrote ' + str(len(data)) + ' bytes to file "' + filename + '".')
have_received_messages = True
Expand Down Expand Up @@ -1574,6 +1573,9 @@ def run():

parser.add_argument('--private_browsing', action='store_true',
help='If specified, opens browser in private/incognito mode.')

parser.add_argument('--dump_out_directory', default='dump_out', type=str,
help='If specified, overrides the directory for dump files using emrun_file_dump method.')

parser.add_argument('serve', nargs='?', default='')

Expand Down