Skip to content

Commit a74696c

Browse files
committed
cmd-diff: rename vars in diff_cmd_outputs
Since we could be operating on directories or files change file_from -> path_from and file_to -> path_to. Also change the temporary output filenames to more properly indicate they are outputs.
1 parent a109ea7 commit a74696c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/cmd-diff

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,17 @@ def diff_metal(diff_from, diff_to):
401401
shutdown_process(p_to)
402402

403403

404-
def diff_cmd_outputs(cmd, file_from, file_to):
405-
with tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as f_from, \
406-
tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as f_to:
407-
for file, output in (file_from, f_from), (file_to, f_to):
404+
def diff_cmd_outputs(cmd, path_from, path_to):
405+
with tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as from_output, \
406+
tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as to_output:
407+
for path, output in (path_from, from_output), (path_to, to_output):
408408
c = list(cmd)
409409
if '{}' not in c:
410410
c += ['{}']
411411
idx = c.index('{}')
412-
c[idx] = file
413-
subprocess.run(c, check=True, stdout=file).stdout
414-
git_diff(f_from.name, f_to.name)
412+
c[idx] = path
413+
subprocess.run(c, check=True, stdout=output).stdout
414+
git_diff(from_output.name, to_output.name)
415415

416416

417417
def git_diff(arg_from, arg_to):

0 commit comments

Comments
 (0)