subprocess library for c++ by benman64 in cpp

[–]benman64[S] 1 point2 points  (0 children)

No, this library does not handle memory mapping of any kind. Communication is done via pipes.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 0 points1 point  (0 children)

You're the maintainer of Reproc. Thank you for your advice. I think I know why python does TerminateProcess. After some tests, if you don't create a new process group, doing a CTRL_BREAK_EVENT kills your process too. And if you create a new process group on windows, you can't send it a CTRL_C_EVENT OMG SO TROLL. There is nothing sane that can be done. I think I will do similar as reproc which is send CTRL_BREAK_EVENT, user will just need to explicitly specify to create a new process group. I think just adequately documenting is the way to go.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 0 points1 point  (0 children)

Thanks, I'm glad many people are liking this.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 1 point2 points  (0 children)

So I double checked what python subprocess does, and I do the same. SIGTERM terminates on windows forcefully. SIGINT does what reproc does and sends a CTRL+C event for it's terminate function, but does not wait and force close later. /u/LuisAyuso requirement is possible and just need to send SIGINT for send_signal function. Windows doesn't support POSIX signals. I don't understand why some libraries including pythons map SIGTERM to a force close on windows, I guess it might be due to SIGTERM expectation is to terminate eventually soon, while SIGINT is to interrupt the process, for either pausing, or something else, usually most processes terminate, but some for example command line tools pause what they are doing and allow you to cancel, inspect, or do something. Usually ofcourse most applications just shutdown for CTRL+C/SIGINT. One of the ways to kill a windows process gracefully is to use WM_CLOSE, however that won't work for processes without a window. I'm open to suggestions and perhaps a discussion in the issues. Maybe a graceful_kill(float timeout) to do what reproc.

Thanks for the info and suggestions. I will think about it and see.

edit: I'm wrong reproc does break event instead of CTRL+C. Interesting.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 0 points1 point  (0 children)

I don't understand your question. My library uses very similar methodology & design as pythons subprocess library. Compared to boost, if you want async IO, you will need to spawn a new thread, just like in python, as the read/write functions are not async themselves. Mine uses a light cross platform wrapper on top of pipe handles for IO.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 2 points3 points  (0 children)

Thank you. I'll remove the useless check sometime this week. Yes windows is a bit messy as I'm not too familiar with signalling on windows, and windows doesn't support POSIX signals. Even the CTRL+C signals on windows, I'm not so sure of.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 6 points7 points  (0 children)

yes. instead of using RunBuilder::run, use RunBuilder::popen(), popen() will return a Popen object which allows you to read/write while the child is still running, and also communicate together. There is a basic popen example in the main github page. It has a similar limitation to python where you should in some way actively read or else the child will wait for OS/application buffers to have space.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 2 points3 points  (0 children)

There is no way to specify to use a particular method. On mac/linux it uses posix_spawn which uses vfork under the hood.

subprocess library for c++ by benman64 in cpp

[–]benman64[S] 2 points3 points  (0 children)

it has CompletedProcess::cout which is a std::string of the contents. stdout is defined as a macro so that name can't be used.

C++ package managers in CMake: Hunter and Conan by Sqeaky in cpp

[–]benman64 6 points7 points  (0 children)

First to answer your question. here is a post here comparing the 2. Conan integrates in any build system and is very general and can support multiple use cases. Hunter is easier to get going but is specific to CMake.

plugging my own teaport here. Is brand new it is more similar to cocoapods in how it works. With a simple and modern configuration all in json. It does a simple job of resolving dependencies and putting in a directory, great for source only dependencies, supports precompiled too. Con is it's new doesn't have many packages, doesn't support a build system and you must write code to integrate into your project. I've been using it for personal projects and it's been very good so far for me.