summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/system_exec.h4
-rw-r--r--libs/ardour/export_graph_builder.cc2
-rw-r--r--libs/ardour/export_handler.cc2
-rw-r--r--libs/ardour/vst_info_file.cc2
-rw-r--r--libs/backends/alsa/alsa_audiobackend.cc2
-rw-r--r--libs/pbd/pbd/system_exec.h8
-rw-r--r--libs/pbd/system_exec.cc12
7 files changed, 19 insertions, 13 deletions
diff --git a/libs/ardour/ardour/system_exec.h b/libs/ardour/ardour/system_exec.h
index ae865c7bff..010a076c01 100644
--- a/libs/ardour/ardour/system_exec.h
+++ b/libs/ardour/ardour/system_exec.h
@@ -35,8 +35,8 @@ public:
SystemExec (std::string c, const std::map<char, std::string> subs);
~SystemExec ();
- int start (int stderr_mode = 1) {
- return PBD::SystemExec::start(stderr_mode, _vfork_exec_wrapper);
+ int start (StdErrMode stderr_mode = IgnoreAndClose) {
+ return PBD::SystemExec::start (stderr_mode, _vfork_exec_wrapper);
}
private:
diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc
index 2fd1df2e89..5afb5c1e7d 100644
--- a/libs/ardour/export_graph_builder.cc
+++ b/libs/ardour/export_graph_builder.cc
@@ -383,7 +383,7 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr<AudioGrapher::CmdPip
* SystemExec is deleted when writer is destroyed */
ARDOUR::SystemExec* exec = new ARDOUR::SystemExec (ffmpeg_exe, argp);
PBD::info << "Encode command: { " << exec->to_s () << "}" << endmsg;
- if (exec->start(0)) {
+ if (exec->start ()) {
throw ExportFailed ("External encoder (ffmpeg) cannot be started.");
}
writer.reset (new AudioGrapher::CmdPipeWriter<T> (exec, writer_filename));
diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc
index cd3d61731d..c39d630d69 100644
--- a/libs/ardour/export_handler.cc
+++ b/libs/ardour/export_handler.cc
@@ -422,7 +422,7 @@ ExportHandler::finish_timespan ()
ARDOUR::SystemExec *se = new ARDOUR::SystemExec(fmt->command(), subs);
info << "Post-export command line : {" << se->to_s () << "}" << endmsg;
se->ReadStdout.connect_same_thread(command_connection, boost::bind(&ExportHandler::command_output, this, _1, _2));
- int ret = se->start (2);
+ int ret = se->start (SystemExec::MergeWithStdin);
if (ret == 0) {
// successfully started
while (se->is_running ()) {
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc
index d6d946dee6..189288ce15 100644
--- a/libs/ardour/vst_info_file.cc
+++ b/libs/ardour/vst_info_file.cc
@@ -998,7 +998,7 @@ vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanM
ARDOUR::SystemExec scanner (scanner_bin_path, argp);
PBD::ScopedConnectionList cons;
scanner.ReadStdout.connect_same_thread (cons, boost::bind (&parse_scanner_output, _1 ,_2));
- if (scanner.start (2 /* send stderr&stdout via signal */)) {
+ if (scanner.start (ARDOUR::SystemExec::MergeWithStdin)) {
PBD::error << string_compose (_("Cannot launch VST scanner app '%1': %2"), scanner_bin_path, strerror (errno)) << endmsg;
close_error_log ();
return infos;
diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc
index 1355197522..00c6940d7c 100644
--- a/libs/backends/alsa/alsa_audiobackend.cc
+++ b/libs/backends/alsa/alsa_audiobackend.cc
@@ -2831,7 +2831,7 @@ AlsaDeviceReservation::acquire_device (const char* device_name)
_device_reservation->ReadStdout.connect_same_thread (_reservation_connection, boost::bind (&AlsaDeviceReservation::reservation_stdout, this, _1 ,_2));
_device_reservation->Terminated.connect_same_thread (_reservation_connection, boost::bind (&AlsaDeviceReservation::release_device, this));
- if (_device_reservation->start(0)) {
+ if (_device_reservation->start (SystemExec::ShareWithParent)) {
PBD::warning << _("AlsaAudioBackend: Device Request failed.") << endmsg;
release_device();
return false;
diff --git a/libs/pbd/pbd/system_exec.h b/libs/pbd/pbd/system_exec.h
index 1e36c3df9f..a567e3b032 100644
--- a/libs/pbd/pbd/system_exec.h
+++ b/libs/pbd/pbd/system_exec.h
@@ -122,6 +122,12 @@ class LIBPBD_API SystemExec
std::string to_s() const;
+ enum StdErrMode {
+ ShareWithParent = 0,
+ IgnoreAndClose = 1,
+ MergeWithStdin = 2
+ };
+
/** fork and execute the given program
*
* @param stderr_mode select what to do with program's standard error
@@ -133,7 +139,7 @@ class LIBPBD_API SystemExec
* @return If the process is already running or was launched successfully
* the function returns zero (0). A negative number indicates an error.
*/
- int start (int stderr_mode, const char *_vfork_exec_wrapper);
+ int start (StdErrMode, const char *_vfork_exec_wrapper);
/** kill running child-process
*
* if a child process exists trt to shut it down by closing its STDIN.
diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc
index b7a7f87123..23f808a0c3 100644
--- a/libs/pbd/system_exec.cc
+++ b/libs/pbd/system_exec.cc
@@ -529,7 +529,7 @@ SystemExec::is_running ()
}
int
-SystemExec::start (int stderr_mode, const char * /*vfork_exec_wrapper*/)
+SystemExec::start (StdErrMode stderr_mode, const char * /*vfork_exec_wrapper*/)
{
char* working_dir = 0;
@@ -541,10 +541,10 @@ SystemExec::start (int stderr_mode, const char * /*vfork_exec_wrapper*/)
create_pipe(stdinP, true);
create_pipe(stdoutP, false);
- if (stderr_mode == 2) {
+ if (stderr_mode == MergeWithStdin) {
/* merge stout & stderr */
DuplicateHandle(GetCurrentProcess(), stdoutP[1], GetCurrentProcess(), &stderrP[1], 0, TRUE, DUPLICATE_SAME_ACCESS);
- } else if (stderr_mode == 1) {
+ } else if (stderr_mode == IgnoreAndClose) {
//TODO read/flush this pipe or close it...
create_pipe(stderrP, false);
} else {
@@ -807,7 +807,7 @@ SystemExec::is_running ()
}
int
-SystemExec::start (int stderr_mode, const char *vfork_exec_wrapper)
+SystemExec::start (StdErrMode stderr_mode, const char *vfork_exec_wrapper)
{
if (is_running ()) {
return 0;
@@ -889,12 +889,12 @@ SystemExec::start (int stderr_mode, const char *vfork_exec_wrapper)
::dup2 (pout[1], STDOUT_FILENO);
}
- if (stderr_mode == 2) {
+ if (stderr_mode == MergeWithStdin) {
/* merge STDERR into output */
if (pout[1] != STDERR_FILENO) {
::dup2(pout[1], STDERR_FILENO);
}
- } else if (stderr_mode == 1) {
+ } else if (stderr_mode == IgnoreAndClose) {
/* ignore STDERR */
::close(STDERR_FILENO);
} else {