From d4a39a3e6708f3d123256d683a88bdc1a4b3f433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20=C3=87olako=C4=9Flu?= Date: Sun, 21 Mar 2021 23:40:48 +0300 Subject: [PATCH] Fixed bug while on sync --- src/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 78d8f45..e990471 100644 --- a/src/index.js +++ b/src/index.js @@ -87,7 +87,9 @@ const syncIfNecessary = (args, session) => { console.debug('syncing vault...') bwRun('sync', `--session=${session}`) writeFileSync('/tmp/bwdmenu_lastsync', new Date().toISOString(),{encoding:'utf8', flag:'w'}); - unlinkSync("/tmp/bwdmenu_accounts"); + if(existsSync('/tmp/bwdmenu_accounts')){ + unlinkSync("/tmp/bwdmenu_accounts"); + } getAccounts(args, session); return; } @@ -99,7 +101,9 @@ const syncIfNecessary = (args, session) => { bwRun('sync', `--session=${session}`) console.debug(`sync complete, last sync was ${last}`) writeFileSync('/tmp/bwdmenu_lastsync',new Date().toISOString(),{encoding:'utf8', flag:'w'}); - unlinkSync("/tmp/bwdmenu_accounts"); + if(existsSync('/tmp/bwdmenu_accounts')){ + unlinkSync("/tmp/bwdmenu_accounts"); + } getAccounts(args, session); } }