From 15d34122b3a5c26585a80395014884464a2ee35f Mon Sep 17 00:00:00 2001 From: d_m Date: Mon, 22 Jan 2024 23:37:17 -0500 Subject: [PATCH] per iteration tempfiles --- uxnrepl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/uxnrepl b/uxnrepl index d580530..a6e7cf5 100755 --- a/uxnrepl +++ b/uxnrepl @@ -39,17 +39,16 @@ template = ''' @wst "wst 20 00 ''' -_, tmp_tal = mkstemp(suffix='.tal', prefix='uxnrepl') -_, tmp_rom = mkstemp(suffix='.rom', prefix='uxnrepl') - -def write_rom(s): - f = open(tmp_tal, 'w') +def write_rom(path, s): + f = open(path, 'w') prog = template % s f.write(prog) f.close() def run(s): - write_rom(s) + _, tmp_tal = mkstemp(suffix='.tal', prefix='uxnrepl') + _, tmp_rom = mkstemp(suffix='.rom', prefix='uxnrepl') + write_rom(tmp_tal, s) res = system('uxnasm %s %s 2>/dev/null' % (tmp_tal, tmp_rom)) if res != 0: system('uxnasm %s %s' % (tmp_tal, tmp_rom))