0

I have a function

async function mount(path1, path2) {
    exec(`sudo mount ${path1} ${path2}`, (error, stdout, stderr) => {
        if (error) {
            console.log(`error: ${error.message}`);
            return false;
        }
        if (stderr) {
            console.log(`stderr: ${stderr}`);
            return false;
        }
        console.log(`Mounted: ${path1} to ${path2}`);
        return true;
    });
}

I am calling this function from another file and am awaiting the resposne

const isMounted = await genericFunctions.mount(req.body.path, userDetails.path)
console.log(isMounted)

isMounted is always undefined, even though when I debug, I can see the correct "Return Value" being set in the function, its just not sending it back to isMounted...

Sure im doing something stupid...

Karl
  • 599
  • 7
  • 27

0 Answers0