summaryrefslogtreecommitdiff
path: root/zen/shell_execute.h
blob: b80cf2baefb6696873ca0184d5da38df59a76164 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// *****************************************************************************
// * 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
{
std::vector<Zstring> parseCommandline(const Zstring& cmdLine);


DEFINE_NEW_SYS_ERROR(SysErrorTimeOut)
[[nodiscard]] std::pair<int /*exit code*/, std::wstring> consoleExecute(const Zstring& cmdLine, std::optional<int> timeoutMs); //throw SysError, SysErrorTimeOut
/* limitations: Windows:     cmd.exe returns exit code 1 if file not found (instead of throwing SysError) => nodiscard!
                Linux/macOS: SysErrorTimeOut leaves zombie process behind                  */

void openWithDefaultApp(const Zstring& itemPath); //throw FileError
}

#endif //SHELL_EXECUTE_H_23482134578134134
bgstack15