Commit Graph

334 Commits

Author SHA1 Message Date
Patrick José Pereira
73f3126a59 subprocess: Add missing include for std::runtime_error
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-11-18 11:58:15 -03:00
TheAssassin
b6a1ba290e Close file descriptors when process has exited 2020-10-07 04:37:50 +02:00
TheAssassin
3c21d86574 Improve file descriptor connection
Instead of passing the fd array for no real reason, the actual fd is passed from now on. The lambda now also logs error message received via errno.
2020-10-07 04:25:14 +02:00
TheAssassin
2554b35403 Check return code of ::close
It appears to be pretty common not to check the return code, but it's a serious programming flaw.
2020-10-07 03:37:00 +02:00
TheAssassin
bfcde878e2 Log error when pipe creation fails 2020-10-05 22:35:15 +02:00
Joker_
76f1d8fee5 Read ldd error message from both stdout and stderr 2020-09-23 11:49:24 +08:00
TheAssassin
407ecc408d Read subprocesses' pipes until they're empty 2020-09-22 13:04:23 +02:00
TheAssassin
8ee0e43c23 Switch to new subprocess lib in type 0 plugins, mk. 3
This commit fixes the remaining buffer issues by introducing a little more complexity. It shall be refactored in the future to decrease complexity again, but for now, it works well and function is more important than form at this point.

CC #143
2020-09-04 18:02:40 +02:00
TheAssassin
e9bbbc80f4 Switch to new subprocess lib in type 0 plugins, mk. 2
Apparently fixes all buffer-related crashes, but there's a few minor bugs left.

CC #143
2020-08-31 08:39:43 +02:00
TheAssassin
68f4655fc4 Add method to write from buffers to ldLog streams 2020-08-31 06:30:06 +02:00
TheAssassin
1072c6d9f0 Improve check_output performance 2020-08-31 05:08:24 +02:00
TheAssassin
6621f1edf7 Forgot to add pipe reader to CMake 2020-08-31 04:20:40 +02:00
TheAssassin
ee73ac6c8e Use new pipe_reader in subprocess's check_output
The class will read until the process quits (or until memory's up).

TODO: reduce load on CPU with some sleep (right now, it's pretty much some busy waiting)
2020-08-31 04:20:03 +02:00
TheAssassin
66691ee882 Add new helper class pipe reader
Implements synchronous, non-block reading from pipes.
2020-08-28 17:36:56 +02:00
TheAssassin
e91b459fce Use std::distance instead of pointer arithmetics 2020-08-08 11:54:58 +02:00
TheAssassin
3f86f178a5 Use classic C string handling
That way, we don't have to allocate memory, and it's also shorter.
2020-08-08 11:49:17 +02:00
TheAssassin
a8975e0e50 Clean up memory in case exec* fails
Prevents memory leaks.
2020-08-08 11:44:21 +02:00
TheAssassin
6c47939fdc Fix initialization bug 2020-08-08 11:34:02 +02:00
TheAssassin
8663e5bf26 Update license information in help text 2020-08-08 01:06:51 +02:00
TheAssassin
b39dfa6591 Fix static binaries handling 2020-08-08 00:30:28 +02:00
TheAssassin
484ff3f004 Fix C string processing bug
Well, makes sense now that I look at it... but caused a couple of hours worrying why my child processes were crashing until I noticed it'd only happen if I specified custom environment variables...
2020-08-08 00:30:28 +02:00
TheAssassin
8b604871cc Refactor duplicate code into static method 2020-08-08 00:30:28 +02:00
TheAssassin
88dd09f2d1 Set all variables to defaults in header 2020-08-08 00:30:28 +02:00
TheAssassin
5feef7880e Try to fix waitpid issues 2020-08-08 00:30:28 +02:00
TheAssassin
aeb0bfa98b Use consistent error message for all plugins 2020-08-07 21:22:58 +02:00
TheAssassin
37aa37f5fe Fix behavior of close()
The implementation was obviously wrong/incomplete.
2020-08-07 21:22:58 +02:00
TheAssassin
59a8ec41ba Replace cpp-subprocess with own linuxdeploy-subprocess 2020-08-07 21:22:58 +02:00
TheAssassin
4a0cfe323d Require newer CMake version only for static builds 2020-08-07 21:22:58 +02:00
TheAssassin
c895a1dc59 Add kill and poll features for processes 2020-08-07 21:22:58 +02:00
TheAssassin
80a5667ca7 Check waitpid() for errors 2020-08-07 21:22:58 +02:00
TheAssassin
2425ccc832 Extract process handling into separate class
Needed for plugins' subprocess handling.
2020-08-07 21:22:58 +02:00
TheAssassin
e1f6da17b4 Add basic subprocess micro library
cpp-subprocess does not work when linked statically for some weird reason. Therefore, we're going to ship our own.
2020-08-07 21:22:58 +02:00
TheAssassin
86d4404a16 Try to use target_link_options again 2020-08-07 21:22:58 +02:00
TheAssassin
cbfbb1ee2d Debug CI build issues mk. 1 2020-08-07 21:22:58 +02:00
TheAssassin
5b713b3bee Add support for fully static builds 2020-08-06 02:07:31 +02:00
TheAssassin
5644d5ca06 Add license notices to binary for dependencies
Was long overdue.
2020-08-06 01:19:29 +02:00
TheAssassin
557bad2241 Add --deploy-deps-only 2020-07-15 03:17:37 +02:00
TheAssassin
590a746882 Replace std::cerr messages with ldLog
Was long overdue now. Makes for a consistent logging, and helps communicate that the messages are errors to the user.
2020-07-15 03:10:12 +02:00
TheAssassin
0f3a118687 Add param to automatically rename deployed icons
Useful e.g., when passing multiple icons with different resolutions via -i, if they have the resolution in the filename.

Also removes all traces of that appName concept that has been abandoned.
2020-06-11 21:04:33 +02:00
TheAssassin
d086da38c4 Allow users to use custom patchelf
Fixes #120.
2020-02-06 02:34:37 +01:00
TheAssassin
652ef5a215 Use the right method to resolve symlinks
Just checked with absolute, it doesn't always resolve symlinks. canonical is supposed to do that according to https://www.boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/reference.html#Canonical-path.
2019-12-13 17:53:28 +01:00
TheAssassin
2b13c52452 Workaround for ldd bug
Closes #110.

See https://sourceware.org/bugzilla/show_bug.cgi?id=25263 for more information.
2019-12-13 17:49:22 +01:00
TheAssassin
c45cd46319 Move which to utils module
Also uses the native split functionality provided by the utils module
instead of some external dependency's.

Preparation for using this method in plugins such as the Qt plugin.
2019-11-19 11:28:24 +01:00
TheAssassin
1bd5453c61 Fix detection of copyright tools
CC #104
2019-11-18 23:13:44 +01:00
TheAssassin
9783db602e Quick fix unavailability of which command
CC #104
2019-11-18 20:44:53 +01:00
TheAssassin
6cfa741f40 Add missing newline (fixes #102) 2019-11-13 15:31:52 +01:00
TheAssassin
3c4580a325 Allow bundling of additional binaries without moving them
Required to bundle e.g., applications' plugins together with their
dependencies without moving them out of position so they can still
be found by the original apps.
2019-09-22 19:06:00 +02:00
TheAssassin
f20af7dc67 Refactor and improve relative directory calculation
Also makes variable names less ambiguous and adds some documenting
comments.
2019-09-22 18:58:21 +02:00
TheAssassin
0ba33879b0 Fix argument forwarding in generated AppRun script 2019-09-12 16:35:09 +02:00
TheAssassin
612bf962a3 Another missing return statement 2019-08-15 01:10:02 +02:00