From d299ddd2f27a437f0fc0cb49abdfd6dd8e3d94f8 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 2 Feb 2021 11:44:31 -0500 Subject: add upstream 11.6 --- zen/process_exec.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 zen/process_exec.h (limited to 'zen/process_exec.h') 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 consoleExecute(const Zstring& cmdLine, std::optional 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 -- cgit