Commit graph

60 commits

Author SHA1 Message Date
Robin Gareus
18474d89f8
SystemExec try SIGINT before SIGKILL
Even though SIGINT is intended to be sent from terminals only,
it is more successful at terminating various child processes than
closing stdin and sending SIGTERM.
2022-09-12 16:17:55 +02:00
Robin Gareus
e15fb0dc38
Fix unset of LIBRARY_PATH environment variable
see also 82d491cb80
2022-04-01 20:50:28 +02:00
Robin Gareus
82d491cb80
Allow to unset LD_LIBRARY_PATH on exec
This is useful when using distro-packaged video-tools
(e.g. on Linux/ARM), or when running post-export commands.
2022-04-01 18:19:55 +02:00
Robin Gareus
abbf1ca698
Allow to get exit status from child processes 2022-03-11 18:18:06 +01:00
Robin Gareus
1e5ccd4acc
Use poll timeout workaround on macOS only
Other systems implement proper poll according
to POSIX and return when the pipe is closed.
2021-06-21 03:48:04 +02:00
Robin Gareus
f4166fb61d Fix endless poll on macOS #8753
Harvid daemonizes and does not write anything
to stdout/err. as opposed to select(), poll() on
macOS does not return when the child process
terminates or is killed.

However poll() on an invalid FD does throw an
error and POLLNVAL is set.
2021-06-21 01:58:40 +02:00
Robin Gareus
0e570d15ae
Amend 3a7ea6b, do not kill child after 10 sec w/o output
This fixes video-timeline issues (harvid has no output), as well
as ALSA device reservation and xjadeo (when idle).
2021-06-08 23:23:31 +02:00
Paul Davis
ade679f162 move <poll.h> inside an appropriate #ifdef, since it does not exist on Windows 2021-05-06 14:45:56 -06:00
Paul Davis
3a7ea6b217 use poll(2) rather than select(2) for reading output from an exec'ed process
select(2) can only handle file descriptors up to 1024, and there are fairly easy to reproduce
cases where the file descriptor used here is larger than that.
2021-05-06 14:41:28 -06:00
Robin Gareus
cf0904f752
Handle vfork/exec failure
Don't call atexit, exit without cleanup.
2020-10-31 22:33:10 +01:00
Robin Gareus
a9bd7b2848
Remove unused compile-time option to not use vfork 2020-10-31 22:30:45 +01:00
Robin Gareus
7896c30508
Fix cmdline parameter escape 2020-10-31 13:42:14 +01:00
Robin Gareus
c365c6cdb2
Set thread-names (libs) 2020-03-29 14:56:22 +02:00
Robin Gareus
b157e1a09a
Remove invalid error message
This clause is in NO_VFORK, vfork_exec_wrapper is irrelevant there
2019-11-09 06:30:46 +01:00
Robin Gareus
a8a699133e
Fix child-process communication (video monitor in particular)
103ef2ba08 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.
2019-11-09 06:28:55 +01:00
Robin Gareus
0301c47f6b
Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
Robin Gareus
e76e18af96
Use exit-status macros for compatibility 2/3 2019-07-04 22:21:35 +02:00
Robin Gareus
86138d18f9
Remove extra quotes from meta-data
Arguments are passed as argp[] array to execve() and don't need to be
enclosed by quotes.
2019-03-26 22:12:48 +01:00
Robin Gareus
15cd1163fc
Pass stderr mode properly to vfork wrapper 2019-03-07 23:51:04 +01:00
Robin Gareus
8b5437301b
Close stderr of child processes on MacOS
This fixes a bug on some modern mac systems. Related to
setup_logging() changing stderr to use ASL and write to com.apple.console.

When a forked application writes to stderr while ASL is used,
the child is terminated for some reason.
2019-03-05 22:52:53 +01:00
Robin Gareus
e1ffe7857f
Use enum for exec stderr parameter (1/2) 2019-03-05 22:49:15 +01:00
Robin Gareus
7048d86d6c
Remove unused define 2019-02-26 03:49:02 +01:00
Robin Gareus
28f211c5d2
NO-OP: whitespace 2019-01-23 12:59:17 +01:00
Robin Gareus
87602e7fb3
system-exec read: allow 1 byte for null termination -- #7715 2019-01-23 12:44:10 +01:00
Robin Gareus
1759d1c9c9
Fix a tiny memory-leak when calling vfork 2018-11-29 02:06:42 +01:00
Robin Gareus
d169864b5b Prepare session-metadata export to external command 2018-11-20 23:56:12 +01:00
Robin Gareus
d18b247a05 Fix Windows and Mac Builds
* missing include for locale_to_utf8 (amend 4c6ff5f7e7)
* avoid void* arithemtic (amend 103ef2ba)
2018-11-19 12:54:07 +01:00
Robin Gareus
103ef2ba08 Add API to write raw data to child processes. 2018-11-19 02:26:43 +01:00
Robin Gareus
820bd0fe51 and another typo in d442190b 2016-02-14 00:10:41 +01:00
Robin Gareus
09167d3e59 fix typos in d442190b 2016-02-14 00:02:00 +01:00
Robin Gareus
d442190b8a slightly improved windows post-export hook support. 2016-02-13 23:12:50 +01:00
Robin Gareus
73245c6217 some half-baked support for windows command-arg substitutions 2016-02-13 17:04:11 +01:00
Robin Gareus
108528b63d amend d814acb - SystemExec/Export debugging 2016-02-13 01:39:41 +01:00
Ben Loftis
d814acbb8f add some debugging capability for users of SystemExec. Needs review. 2016-02-12 18:22:12 -06:00
Robin Gareus
eb6b4f4b15 fix crash on SystemExec::Terminate
if Terminated() connects in the same thread and deletes the class itself
the closure in interposer_thread() can fail.
2015-10-23 23:29:04 +02:00
Robin Gareus
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
Paul Davis
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
Robin Gareus
e057b873b5 amend e09c620; now with semicolon :) 2015-08-03 23:09:51 +02:00
Robin Gareus
e09c62052d fix backslashes in quotes (windows), fixes VST scan 2015-08-03 23:06:08 +02:00
Robin Gareus
2b294f0b43 add a sanity check 2015-04-30 21:15:35 +02:00
Robin Gareus
ec01682714 -Wunused-function on windows 2014-11-23 21:01:39 +01:00
Robin Gareus
12025d4ffa possible fix for win SystemExec::wait()
if it does not help, use CREATE_NO_WINDOW and/or peek/pump messages :(
2014-07-11 17:03:55 +02:00
Paul Davis
94e0841625 catch null vfork_exec_wrapper before it is too late 2014-07-11 09:58:45 -04:00
Robin Gareus
4b0933938f optimize SystemExec::output_interposer() 2014-07-06 23:44:48 +02:00
Colin Fletcher
c03034b7d6 Make $PATH search in SystemExec actually work
Make searching of $PATH work when a SystemExec  is created from a
command-line, by making sure that argv[0] is set to the discovered path.
2014-07-05 21:47:49 +01:00
Tim Mayberry
cd12698b9c Rename PBD::find_file_in_search_path to just PBD::find_file
saves a bit of typing and not necessary if you look at how it is used.
2014-06-25 12:40:10 -04:00
Colin Fletcher
f0dbd6c085 Export dialog: tidy code, & remove some superfluous debug output
Remove some debug output, tidy up a few whitespace inconsistencies, use
DEBUG::Soundcloud in one more place, and zap a couple of unused variables.
2014-06-12 23:20:05 +01:00
Colin Fletcher
724a69a8d5 Search $PATH for command when creating SystemExec from command line
When creating a SystemExec from a command-line, search $PATH for the
command to execute, so that post-export hooks don't need to specify a full
path.
2014-06-12 23:20:05 +01:00
Robin Gareus
3813c7afae increase system-exec timeouts for kill. 2014-06-05 02:22:13 +02:00
Colin Fletcher
bc8ccea212 remove debug output from system_exec
remove the debug output from pbd/system_exec: it's of no further use, and
also breaks optimised builds.
2014-05-19 22:49:22 +01:00