Add support for reading stderr
[TortoiseGit.git] / src / libgit2 / system-call.h
blobc28d897a045fdd4a051dbcd4668765e210e5984a
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2014 TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "common.h"
22 typedef struct {
23 PROCESS_INFORMATION pi;
24 HANDLE in;
25 HANDLE out;
26 HANDLE err;
27 bool running;
28 git_buf *errBuf;
29 HANDLE asyncReadErrorThread;
30 } COMMAND_HANDLE;
32 int command_start(wchar_t *cmd, COMMAND_HANDLE *commandHandle, LPWSTR pEnv);
33 void command_close_stdout(COMMAND_HANDLE *commandHandle);
34 void command_close_stdin(COMMAND_HANDLE *commandHandle);
35 DWORD command_close(COMMAND_HANDLE *commandHandle);
36 int command_read_stdout(COMMAND_HANDLE *commandHandle, char *buffer, size_t buf_size, size_t *bytes_read);
37 int command_write(COMMAND_HANDLE *commandHandle, const char *buffer, size_t len);
38 int command_write_gitbuf(COMMAND_HANDLE *commandHandle, const git_buf *buf);
39 HANDLE commmand_start_stdout_reading_thread(COMMAND_HANDLE *commandHandle, git_buf *dest);