mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
error message for writing to bad location as well
This commit is contained in:
parent
20e698f6f1
commit
6ff6812a05
1 changed files with 5 additions and 2 deletions
|
@ -396,8 +396,11 @@ def run_subproc(cmds, captured=True):
|
|||
output = prev_proc.stdout if isinstance(prev_proc, ProcProxy) else \
|
||||
prev_proc.communicate()[0]
|
||||
if write_target is not None:
|
||||
with open(write_target, write_mode) as f:
|
||||
f.write(output)
|
||||
try:
|
||||
with open(write_target, write_mode) as f:
|
||||
f.write(output)
|
||||
except FileNotFoundError:
|
||||
print('xonsh: {0}: no such file or directory'.format(write_target))
|
||||
if captured:
|
||||
return output
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue