Store bat file in a temp directory.
This commit is contained in:
parent
1e011ef7b7
commit
b9cd946110
1 changed files with 9 additions and 3 deletions
|
|
@ -897,6 +897,7 @@ class CommandBase(object):
|
||||||
export_dirs.append('{}{}{}'.format(export_dir, os.path.sep, opt))
|
export_dirs.append('{}{}{}'.format(export_dir, os.path.sep, opt))
|
||||||
|
|
||||||
command = None
|
command = None
|
||||||
|
bat_file = None
|
||||||
|
|
||||||
if ext == '.py':
|
if ext == '.py':
|
||||||
env_file = get_file('files/env_vars.py')
|
env_file = get_file('files/env_vars.py')
|
||||||
|
|
@ -948,15 +949,20 @@ class CommandBase(object):
|
||||||
num_dirs=len(export_dirs),
|
num_dirs=len(export_dirs),
|
||||||
export_dirs=ex_dir_vars,
|
export_dirs=ex_dir_vars,
|
||||||
**export_dict)
|
**export_dict)
|
||||||
batcontents = '{}{}'.format(env_vars, contents)
|
batcontents = '{}\n{}'.format(env_vars, contents)
|
||||||
|
|
||||||
command = ['cmd', '/c', batcontents]
|
bat_file = utils.path_join(TEMP_DIR, '{}.bat'.format(self.project_name()))
|
||||||
|
|
||||||
proc = subprocess.Popen(' '.join(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
command = [bat_file]
|
||||||
|
|
||||||
|
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
output, error = proc.communicate()
|
output, error = proc.communicate()
|
||||||
output = output.strip()
|
output = output.strip()
|
||||||
error = error.strip()
|
error = error.strip()
|
||||||
|
|
||||||
|
if bat_file:
|
||||||
|
os.remove(bat_file)
|
||||||
|
|
||||||
with open(get_file('script-output.txt'), 'w+') as f:
|
with open(get_file('script-output.txt'), 'w+') as f:
|
||||||
f.write('Output:\n{}'.format(output))
|
f.write('Output:\n{}'.format(output))
|
||||||
if error:
|
if error:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue