i am writing some functions on c++ for compiler less to css.
i installed nodejs, less.
i created a less file test.less
@color: red;
a{color:@color;}
when i run command on terminal:
lessc test.less test.css
it created a files css with name is test.css, but when i run this command via c++, it return a error. please help me. this is my c++ function:
std::string shell_exec( std::string cmd )
{
    std::string result = "";
    FILE* pipe = popen(cmd.c_str(), "r");
    if (pipe == NULL)
    {
        return result;
    }
   char buffer[128];
   while(!feof(pipe))
   {
        if(fgets(buffer, 128, pipe) != NULL)
        {
            result += buffer;
        }
    }
    pclose(pipe);
    return result;
} 
shell_exec("lessc test.less test.css");
i got a error:
/usr/bin/env: node: No such file or directory
/usr/bin/node is existed.
 
 

================ UPDATE: Fixed==================
Thank you @Bass Jobsen , @Lightness Races in Orbit
i fixed by add absolute path to lessc and nodejs
shell_exec("/usr/bin/node /usr/bin/lessc test.less test.css");
 
     
    