Run Drush Commands With JavaScript

const { exec } = require("child_process");  
  
exec("./vendor/bin/drush sa", (error, stdout, stderr) => {  
    if (error) {  
        console.log(`error: ${error.message}`);  
        return;  
    }  
    if (stderr) {  
        console.log(`stderr: ${stderr}`);  
        return;  
    }  
    console.log(`stdout: ${stdout}`);  
});

 

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.