Commit graph

66 commits

Author SHA1 Message Date
Robin Gareus
0b8d5d3dc5
Tweak Window system-exec, wait for process to terminate 2023-04-05 00:16:37 +02:00
Robin Gareus
3715154a8e
Allow concurrent child processes
When multiple child processes are running, closing the
stdin of one child did not send EOF or cause POLLNVAL,
as long as a dup()'ed filedes still existed.

This fixes an issue when running an mp3 encoder while the
video monitor is visible, and will allow to concurrently
run multiple mp3 encoders or other child processes.

Previously this caused Ardour to hang indefinitely in CmdPipeWriter
```
 _proc->close_stdin();
 _proc->wait(); // << here
```
2023-03-25 06:43:46 +01:00
Robin Gareus
2522deabda
SystemExec: tweak writing to stdin of child process 2023-01-16 16:39:37 +01:00
Robin Gareus
09b0734028
Increase system-exec stdout bufsiz (from 512 to 8k) 2023-01-05 04:54:07 +01:00
Robin Gareus
27e136dcfc
Cont'd tweaks of ffmpeg export pipe 2023-01-05 03:32:40 +01:00
Robin Gareus
3da7f71fb6
Windows process: allow for binary data output
Do not rely on null termination.
2023-01-04 20:28:22 +01:00
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