summaryrefslogtreecommitdiff
path: root/zen/process_exec.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-02-02 21:49:34 +0000
committerB Stack <bgstack15@gmail.com>2021-02-02 21:49:34 +0000
commit26b8bd6eb07b78adad36049e03494a2931b231af (patch)
tree4d7c950512836f473a6a8cbb521c61e800db6584 /zen/process_exec.h
parentMerge branch '11.5' into 'master' (diff)
parentadd upstream 11.6 (diff)
downloadFreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.tar.gz
FreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.tar.bz2
FreeFileSync-26b8bd6eb07b78adad36049e03494a2931b231af.zip
Merge branch '11.6' into 'master'11.6
add upstream 11.6 See merge request opensource-tracking/FreeFileSync!30
Diffstat (limited to 'zen/process_exec.h')
-rw-r--r--zen/process_exec.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/zen/process_exec.h b/zen/process_exec.h
new file mode 100644
index 00000000..1c18c3f4
--- /dev/null
+++ b/zen/process_exec.h
@@ -0,0 +1,28 @@
+// *****************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: https://www.gnu.org/licenses/gpl-3.0 *
+// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
+// *****************************************************************************
+
+#ifndef SHELL_EXECUTE_H_23482134578134134
+#define SHELL_EXECUTE_H_23482134578134134
+
+#include "file_error.h"
+
+
+namespace zen
+{
+Zstring escapeCommandArg(const Zstring& arg);
+
+
+DEFINE_NEW_SYS_ERROR(SysErrorTimeOut)
+[[nodiscard]] std::pair<int /*exit code*/, Zstring> consoleExecute(const Zstring& cmdLine, std::optional<int> timeoutMs); //throw SysError, SysErrorTimeOut
+/* Windows: - cmd.exe returns exit code 1 if file not found (instead of throwing SysError) => nodiscard!
+ - handles elevation when CreateProcess() would fail with ERROR_ELEVATION_REQUIRED!
+ - no support for UNC path and Unicode on Win7; apparently no issue on Win10!
+ Linux/macOS: SysErrorTimeOut leaves zombie process behind if timeoutMs is used */
+
+void openWithDefaultApp(const Zstring& itemPath); //throw FileError
+}
+
+#endif //SHELL_EXECUTE_H_23482134578134134
bgstack15