1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
//#define XERR
#include "script.ih"
// First name are the mail headers, 2nd name is the mail input
// (cf. Expr::script)
// overrides
bool Script::vMatch(string const &tmpStreamNames) const
{
string cmd{ d_command.substr(0, d_command.find_first_of(" \t")) };
error_code ec;
if (not exists(cmd, ec))
throw Exception{} << cmd << " DOES NOT EXIST";
file_status stat = status(cmd, ec);
if (
(status(cmd, ec).permissions() & perms::owner_exec)
!= perms::owner_exec
)
throw Exception{} << cmd << " NOT EXECUTABLE";
cmd = d_command + ' ' + tmpStreamNames;
Proc proc{ cmd, Proc::NONE, static_cast<Proc::ProcType>(d_mode) };
proc.start();
int ret = proc.waitForChild();
return ret == 0;
}
|