Re: [Cppcms-users] cppcms::service and system(..)
Brought to you by:
artyom-beilis
|
From: kpeo <sla...@ya...> - 2012-07-18 11:48:16
|
sorry, accidentally hit "send" )
# define MAX_BUFFER 1024
std::string vexec(std::string const &cmd, int timeout)
{
char buf[MAX_BUFFER];
std::string out;
FILE* pipe = popen(cmd.c_str(), "r" );
if (pipe == NULL ) {
BOOSTER_LOG(debug,__FUNCTION__) << "invoking " << cmd << " is failed";
return "";
}
while(fgets(buf, MAX_BUFFER, pipe) != NULL) {
out.append(buf);
}
pclose(pipe);
return out;
}
18.07.2012, 15:03, "Christian Gmeiner" <chr...@gm...>:
> Hi all,
>
> I would like to implement a Service class based on cppcms::service. I would like
> to trigger the rpc call via java script (works) and in the Service
> class I would like
> to use system() function to execute a bash script.
>
> If after executing/while executing the system function the cppcms apps
> hangs completely.
> My Service implements also a RPC call which does a reboot of the
> system - which works.
>
> Any idea what could went wrong?
>
> thanks
> ---
> Christian Gmeiner, MSc
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
|