0

I am trying to execute a child process in a different directory then the one of its parent.

var script = "drush language-add cn";
var folderDrush = "/data/www/sites/site_cn_country";
exec(script, {cwd:folderDrush} , function (err, stdout, stderr) {
    if(err) {
        sendErr("drush", stderr);
        sendCommand(script);
        sendCheck("drush", false);
    }
});

This script returns:

The drush command 'language-add cs' could not be found. Run drush [31;40m[1m[error][0m cache-clear drush to clear the commandfile cache if you have installed new extensions.

But when I execute manualy, drush language-add work fine.

I test there commands too :

  • pwd : /data/www/sites/site_cn_country
  • id -u -n : root
  • ll : Command not found (why ? manually work...)
  • echo $SHELL : /bin/bash
Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
MNicole
  • 3
  • 2

1 Answers1

0

This is not a direct answer, but you could change path before running the command:

var script = "cd /data/www/sites/site_cn_country && drush language-add cn";
Yavor Shahpasov
  • 1,453
  • 1
  • 12
  • 19
  • Same error : The drush command 'language-add cs' could not be found. Run `drush [31;40m[1m[error][0m cache-clear drush` to clear the commandfile cache if you have installed new extensions. – MNicole Oct 13 '14 at 16:05