Explicit exit codes when running register

This commit is contained in:
simojenki
2021-08-06 21:12:58 +10:00
parent 27dc933ee0
commit a1a44370db
2 changed files with 15 additions and 4 deletions

View File

@@ -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
```

View File

@@ -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);
});