From 080cbaff391d602b800f2e60b5f882328ae591a4 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Tue, 15 Sep 2020 02:10:57 -0400 Subject: [PATCH] deflopt: small refactor --- tools/deflopt/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/deflopt/index.ts b/tools/deflopt/index.ts index 0b9a1b83..0418f388 100644 --- a/tools/deflopt/index.ts +++ b/tools/deflopt/index.ts @@ -11,10 +11,12 @@ if (src === undefined || exe === undefined) { throw new Error('tools/deflopt '); } -asTmp("deflopt", src, (dst : string) => { +const ret = asTmp("deflopt", src, (dst : string) => { const {processed, rewritten} = deflopt(exe, dst); - if (processed !== 1) { - throw new Error(`Didn't process any files.`); - } - return {changed: rewritten > 0, ret : null}; + return {changed: rewritten > 0, ret : processed === 1}; }); + +if (!ret) { + console.error(`Didn't process any files.`); + process.exit(1); +}