diff options
author | Robin Gareus <robin@gareus.org> | 2019-11-09 06:28:55 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-11-09 06:28:55 +0100 |
commit | a8a699133e14507e360d93603f685878a9cec1fd (patch) | |
tree | acde85d1e2ac16bb67313b3f128359a76887af3f /libs/pbd | |
parent | edf9478fda3be849797089907e0ff244d35defa6 (diff) |
Fix child-process communication (video monitor in particular)
103ef2ba08e5 introduced an API to write raw data (const void*)
to a child process, along with the previous API to
write (std::string const&)
VideoMonitor uses write_to_stdin("fixed text"), and g++
interprets this to use the (const void*) API instead
of the std::string, which breaks communication.
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/pbd/system_exec.h | 8 | ||||
-rw-r--r-- | libs/pbd/system_exec.cc | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libs/pbd/pbd/system_exec.h b/libs/pbd/pbd/system_exec.h index 9247323786..1d7e631f54 100644 --- a/libs/pbd/pbd/system_exec.h +++ b/libs/pbd/pbd/system_exec.h @@ -181,6 +181,14 @@ class LIBPBD_API SystemExec size_t write_to_stdin (std::string const& d, size_t len=0); /** write into child-program's STDIN + * @param d text to write + * @param len length of data to write, if it is 0 (zero), d.length() is + * used to determine the number of bytes to transmit. + * @return number of bytes written. + */ + size_t write_to_stdin (const char* d, size_t len=0); + + /** write into child-program's STDIN * @param data data to write * @param bytes length of data to write * @return number of bytes written. diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index 7e24e8d1b3..56eba6959e 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -401,6 +401,15 @@ SystemExec::write_to_stdin (std::string const& d, size_t len) return write_to_stdin ((const void*)data, len); } +size_t +SystemExec::write_to_stdin (const char* data, size_t len) +{ + if (len == 0) { + len = strlen (data); + } + return write_to_stdin ((const void*)data, len); +} + #ifdef PLATFORM_WINDOWS /* Windows Process */ /* HELPER FUNCTIONS */ |