| 17 | #include <atomic> |
| 18 | |
| 19 | class TShellCommandOptions { |
| 20 | class TCopyableAtomicBool: public std::atomic<bool> { |
| 21 | public: |
| 22 | using std::atomic<bool>::atomic; |
| 23 | TCopyableAtomicBool(const TCopyableAtomicBool& other) |
| 24 | : std::atomic<bool>(other.load(std::memory_order_acquire)) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | TCopyableAtomicBool& operator=(const TCopyableAtomicBool& other) { |
| 29 | this->store(other.load(std::memory_order_acquire), std::memory_order_release); |
| 30 | return *this; |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | public: |
| 35 | struct TUserOptions { |
| 36 | TString Name; |
| 37 | #if defined(_win_) |
| 38 | TString Password; |
| 39 | #endif |
| 40 | #if defined(_unix_) |
| 41 | /** |
| 42 | * Run child process with the user supplementary groups. |
| 43 | * If true, the user supplementary groups will be set in the child process upon exec(). |
| 44 | * If false, the supplementary groups of the parent process will be used. |
| 45 | */ |
| 46 | bool UseUserGroups = false; |
| 47 | #endif |
| 48 | }; |
| 49 | |
| 50 | enum EHandleMode { |
| 51 | HANDLE_INHERIT, |
| 52 | HANDLE_PIPE, |
| 53 | HANDLE_STREAM |
| 54 | }; |
| 55 | |
| 56 | public: |
| 57 | inline TShellCommandOptions() noexcept |
| 58 | : ClearSignalMask(false) |
| 59 | , CloseAllFdsOnExec(false) |
| 60 | , AsyncMode(false) |
| 61 | , PollDelayMs(DefaultSyncPollDelayMs) |
| 62 | , UseShell(true) |
| 63 | , QuoteArguments(true) |
| 64 | , DetachSession(true) |
| 65 | , CloseStreams(false) |
| 66 | , ShouldCloseInput(true) |
| 67 | , InputMode(HANDLE_INHERIT) |
| 68 | , OutputMode(HANDLE_STREAM) |
| 69 | , ErrorMode(HANDLE_STREAM) |
| 70 | , InputStream(nullptr) |
| 71 | , OutputStream(nullptr) |
| 72 | , ErrorStream(nullptr) |
| 73 | , Nice(0) |
| 74 | , FuncAfterFork(std::function<void()>()) |
| 75 | { |
| 76 | } |
no test coverage detected