From a1a44370db52efd27c49bd8f75c4c379efc1792d Mon Sep 17 00:00:00 2001 From: simojenki Date: Fri, 6 Aug 2021 21:12:58 +1000 Subject: [PATCH] Explicit exit codes when running register --- README.md | 1 + src/register.ts | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 032f134..4a6ed8c 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Now within the LAN that contains the sonos devices run bonob the registration pr ```bash docker run \ + --rm \ --network host \ simojenki/bonob register https://my-server.example.com/bonob ``` diff --git a/src/register.ts b/src/register.ts index 28cbd7c..f6fd9c4 100644 --- a/src/register.ts +++ b/src/register.ts @@ -9,7 +9,17 @@ if (params.length != 1) { } const bonobUrl = new URLBuilder(params[0]!); -registrar(bonobUrl)().then((success) => { - if (success) console.log(`Successfully registered bonob @ ${bonobUrl} with sonos`); - else console.error(`Failed registering bonob @ ${bonobUrl} with sonos`); -}); +registrar(bonobUrl)() + .then((success) => { + if (success) { + console.log(`Successfully registered bonob @ ${bonobUrl} with sonos`); + process.exit(0); + } else { + console.error(`Failed registering bonob @ ${bonobUrl} with sonos`); + process.exit(1); + } + }) + .catch((e) => { + console.error(e); + process.exit(1); + });