feat: add ProcessExecutor, FAKE mode, fix thread lifecycle crash

- Add ProcessExecutor class wrapping PIProcess with proper cleanup
- Add CMake FAKE option (-DFAKE=ON) for testing without opencode
- Add 3 FAKE-mode tests for full pipeline execution, status transitions, output
- Fix PIThread lifecycle: use startOnce() instead of start(), track threads,
  wait + delete in destructor to prevent use-after-free of PIDeque<PIChar>
- Update build.sh with --fake flag and automatic cache invalidation
- Upgrade CMake to C++17 standard
- Update AGENTS.md with build commands and FAKE mode
This commit is contained in:
2026-07-16 09:51:39 +03:00
parent 46e12ef5fe
commit 5ca6927baa
8 changed files with 361 additions and 34 deletions
+20
View File
@@ -0,0 +1,20 @@
#ifndef PROCESSEXECUTOR_H
#define PROCESSEXECUTOR_H
#include <pistring.h>
#include <pistringlist.h>
struct ProcessResult {
int exitCode;
PIString output;
PIString error;
};
class ProcessExecutor {
public:
// Execute a command with args, wait up to timeoutSeconds, return result.
// Only one process runs at a time — synchronous, stack-based PIProcess.
static ProcessResult run(const PIString & command, const PIStringList & args, int timeoutSeconds, const PIString & workingDir);
};
#endif