       realAtomBuild = fs.realpathSync @root + '/.atom-build.json'
       delete require.cache[realAtomBuild]
       build = require realAtomBuild
-      [exec, env, args] = [ build.cmd, build.env, build.args ]
+      [ exec, env, args, cwd ] = [ build.cmd, build.env, build.args, build.cwd ]
 
     if !exec && fs.existsSync @root + '/package.json'
       realPackage = fs.realpathSync @root + '/package.json'

child_process = require 'child_process'
fs = require 'fs'
qs = require 'querystring'
_ = require 'underscore'


    return {
      exec: exec,
      env: env || {},
      args: args || [],
      cwd: cwd || @root
    }

  replace: (value) ->
    activeFile = fs.realpathSync atom.workspace.getActiveEditor().getPath() if atom.workspace.getActiveEditor()
    value = value.replace '{FILE_ACTIVE}', activeFile if atom.workspace.getActiveEditor()
    value = value.replace '{FILE_ACTIVE_PATH}', path.dirname(activeFile) if atom.workspace.getActiveEditor()
    value = value.replace '{PROJECT_PATH}', fs.realpathSync atom.project.getPath()
    value = value.replace '{REPO_BRANCH_SHORT}', atom.project.getRepo().getShortHead() if atom.project.getRepo()
    return value;
