From 80f82e189e71c23d333dbd7f69854f83e5bfd3ce Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 12 Feb 2015 16:18:07 -0800 Subject: [PATCH] Defer runas require until it is used --- src/command-installer.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/command-installer.coffee b/src/command-installer.coffee index b5674d5a7..a1cac4ce9 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -3,7 +3,7 @@ _ = require 'underscore-plus' async = require 'async' fs = require 'fs-plus' mkdirp = require 'mkdirp' -runas = require 'runas' +runas = null # defer until used symlinkCommand = (sourcePath, destinationPath, callback) -> fs.unlink destinationPath, (error) -> @@ -17,6 +17,7 @@ symlinkCommand = (sourcePath, destinationPath, callback) -> fs.symlink sourcePath, destinationPath, callback symlinkCommandWithPrivilegeSync = (sourcePath, destinationPath) -> + runas ?= require 'runas' if runas('/bin/rm', ['-f', destinationPath], admin: true) != 0 throw new Error("Failed to remove '#{destinationPath}'")