From b8099372dd622ce4b310b6c6c761900d4f581a09 Mon Sep 17 00:00:00 2001 From: Petros Angelatos Date: Sun, 21 Jul 2013 16:55:17 +0100 Subject: [PATCH] Use sudo to build the correct running enviroment for the app --- application.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application.coffee b/application.coffee index 55f7b91e..e313dd06 100644 --- a/application.coffee +++ b/application.coffee @@ -15,9 +15,11 @@ class Application extends EventEmitter cwd: @path stdio: 'inherit' uid: getpwnam(@user).uid + gid: getpwnam(@user).gid env: USER: @user USERNAME: @user + HOME: "/home/#{@user}" _init: (callback) -> tasks = [ @@ -45,7 +47,11 @@ class Application extends EventEmitter _start: (callback) -> if not @process - @process = spawn('foreman', ['start'], @options) + options = + cwd: @path + stdio: 'inherit' + + @process = spawn('sudo', ['-u', @user, 'foreman', 'start'], options) @emit('start') callback?()