• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

tests/H03-May-2022-261234

.clang-formatH A D29-Nov-2020223 109

.gitignoreH A D29-Nov-2020643 5142

.gitlab-ci.ymlH A D29-Nov-2020327 1512

LICENSEH A D29-Nov-20201.1 KiB2317

README.mdH A D29-Nov-20202.2 KiB7060

examples.cppH A D29-Nov-20208.6 KiB235189

process.cppH A D29-Nov-20202.3 KiB5646

process.hppH A D29-Nov-20206.2 KiB170128

process_unix.cppH A D29-Nov-20209.9 KiB377324

process_win.cppH A D29-Nov-202010.1 KiB351300

README.md

1# tiny-process-library
2A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process.
3
4This library was created for, and is used by the C++ IDE project [juCi++](https://gitlab.com/cppit/jucipp).
5
6### Features
7* No external dependencies
8* Simple to use
9* Platform independent
10  * Creating processes using executables is supported on all platforms
11  * Creating processes using functions is only possible on Unix-like systems
12* Read separately from stdout and stderr using anonymous functions
13* Write to stdin
14* Kill a running process (SIGTERM is supported on Unix-like systems)
15* Correctly closes file descriptors/handles
16
17### Usage
18See [examples.cpp](examples.cpp).
19
20### Get, compile and run
21
22#### Unix-like systems
23```sh
24git clone http://gitlab.com/eidheim/tiny-process-library
25cd tiny-process-library
26mkdir build
27cd build
28cmake ..
29make
30./examples
31```
32
33#### Windows with MSYS2 (https://msys2.github.io/)
34```sh
35git clone http://gitlab.com/eidheim/tiny-process-library
36cd tiny-process-library
37mkdir build
38cd build
39cmake -G"MSYS Makefiles" ..
40make
41./examples
42```
43
44### Coding style
45Due to poor lambda support in clang-format, a custom clang-format is used with the following patch applied:
46```diff
47diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp
48index bb8efd61a3..e80a487055 100644
49--- a/lib/Format/ContinuationIndenter.cpp
50+++ b/lib/Format/ContinuationIndenter.cpp
51@@ -276,6 +276,8 @@ LineState ContinuationIndenter::getInitialState(unsigned FirstIndent,
52 }
53
54 bool ContinuationIndenter::canBreak(const LineState &State) {
55+  if(Style.ColumnLimit==0)
56+    return true;
57   const FormatToken &Current = *State.NextToken;
58   const FormatToken &Previous = *Current.Previous;
59   assert(&Previous == Current.Previous);
60@@ -325,6 +327,8 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
61 }
62
63 bool ContinuationIndenter::mustBreak(const LineState &State) {
64+  if(Style.ColumnLimit==0)
65+    return false;
66   const FormatToken &Current = *State.NextToken;
67   const FormatToken &Previous = *Current.Previous;
68   if (Current.MustBreakBefore || Current.is(TT_InlineASMColon))
69```
70