Asynchronous code at module startup never goes well with NodeJS.

develop
Icedream 2015-10-16 09:36:52 +02:00
parent fe293ace7c
commit 5cd0c0ee19
1 changed files with 6 additions and 4 deletions

View File

@ -13,10 +13,6 @@ StreamSplitter = require("stream-splitter")
require_bin = require("../require_bin") require_bin = require("../require_bin")
ts3client_binpath = require_bin path.join(config.get("ts3-install-path"), "ts3client_linux_" + (if process.arch == "x64" then "amd64" else process.arch)) ts3client_binpath = require_bin path.join(config.get("ts3-install-path"), "ts3client_linux_" + (if process.arch == "x64" then "amd64" else process.arch))
await fs.access ts3client_binpath, fs.R_OK | fs.X_OK, defer err
if err
log.fatal "Can't access TeamSpeak3 client binary at #{ts3client_binpath}, does the binary exist and have you given correct access?"
throw new Error "Access to TeamSpeak3 binary failed."
module.exports = class TS3ClientService extends services.Service module.exports = class TS3ClientService extends services.Service
dependencies: [ dependencies: [
@ -37,6 +33,12 @@ module.exports = class TS3ClientService extends services.Service
if not args if not args
args = [] args = []
await fs.access ts3client_binpath, fs.R_OK | fs.X_OK, defer err
if err
log.fatal "Can't access TeamSpeak3 client binary at #{ts3client_binpath}, does the binary exist and have you given correct access?"
cb? new Error "Access to TeamSpeak3 binary failed."
return
await @_preconfigure defer() await @_preconfigure defer()
# spawn process # spawn process