add some debugging capability for users of SystemExec. Needs review.

This commit is contained in:
Ben Loftis 2016-02-12 18:22:12 -06:00
parent 0812f3bac1
commit d814acbb8f
3 changed files with 18 additions and 2 deletions

View File

@ -355,15 +355,17 @@ ExportHandler::finish_timespan ()
subs.insert (std::pair<char, std::string> ('n', session.name ())); subs.insert (std::pair<char, std::string> ('n', session.name ()));
ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs); ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs);
info << "Post-export command line : {" << se->GetString() << "}" << endmsg;
se->ReadStdout.connect_same_thread(command_connection, boost::bind(&ExportHandler::command_output, this, _1, _2)); se->ReadStdout.connect_same_thread(command_connection, boost::bind(&ExportHandler::command_output, this, _1, _2));
if (se->start (2) == 0) { int ret = se->start (2);
if (ret == 0) {
// successfully started // successfully started
while (se->is_running ()) { while (se->is_running ()) {
// wait for system exec to terminate // wait for system exec to terminate
Glib::usleep (1000); Glib::usleep (1000);
} }
} else { } else {
error << "post-export hook failed! " << fmt->command() << endmsg; error << "Post-export command FAILED with Error: " << ret << endmsg;
} }
delete (se); delete (se);
} }

View File

@ -115,6 +115,8 @@ class LIBPBD_API SystemExec
virtual ~SystemExec (); virtual ~SystemExec ();
std::string GetString();
/** fork and execute the given program /** fork and execute the given program
* *
* @param stderr_mode select what to do with program's standard error * @param stderr_mode select what to do with program's standard error

View File

@ -282,6 +282,18 @@ SystemExec::make_argp_escaped(std::string command, const std::map<char, std::str
argp[n] = NULL; argp[n] = NULL;
} }
string
SystemExec::GetString ()
{
stringstream out;
if (argp) {
for (int i = 0; argp[i]; ++i) {
out << argp[i];
}
}
return out.str();
}
SystemExec::~SystemExec () SystemExec::~SystemExec ()
{ {
terminate (); terminate ();