add some debugging capability for users of SystemExec. Needs review.
authorBen Loftis <ben@harrisonconsoles.com>
Sat, 13 Feb 2016 00:22:12 +0000 (18:22 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Sat, 13 Feb 2016 00:22:12 +0000 (18:22 -0600)
libs/ardour/export_handler.cc
libs/pbd/pbd/system_exec.h
libs/pbd/system_exec.cc

index 42de0fa0c6f623f7ffc46a63620469270b53b248..96e8052bf47a6ede12432ed26020c7d158919acf 100644 (file)
@@ -355,15 +355,17 @@ ExportHandler::finish_timespan ()
                        subs.insert (std::pair<char, std::string> ('n', session.name ()));
 
                        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));
-                       if (se->start (2) == 0) {
+                       int ret = se->start (2);
+                       if (ret == 0) {
                                // successfully started
                                while (se->is_running ()) {
                                        // wait for system exec to terminate
                                        Glib::usleep (1000);
                                }
                        } else {
-                               error << "post-export hook failed! " << fmt->command() << endmsg;
+                               error << "Post-export command FAILED with Error: " << ret << endmsg;
                        }
                        delete (se);
                }
index b554bdca94c6f6bd1fd055aed3007c2eaab0c0ce..07f7d139a786c66625eb71c456e4794ad9f90267 100644 (file)
@@ -115,6 +115,8 @@ class LIBPBD_API SystemExec
 
                virtual ~SystemExec ();
 
+               std::string GetString();
+
                /** fork and execute the given program
                 *
                 * @param stderr_mode select what to do with program's standard error
index 02e4ddcd85a11b6ad3aa37fdb83427cacb5c77aa..fc66e1f6e48f872837e87eb0b11d241efce3af2a 100644 (file)
@@ -282,6 +282,18 @@ SystemExec::make_argp_escaped(std::string command, const std::map<char, std::str
        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 ()
 {
        terminate ();