File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change 101
101
102
102
# define BUFSIZE 2048
103
103
104
+ #ifdef _WIN32
105
+ std::wstring process_windows_args (const std::vector<std::string> commandvec)
106
+ {
107
+ std::wstring result = widen (commandvec[0 ]);
108
+ for (int i = 1 ; i < commandvec.size (); i++)
109
+ {
110
+ result.append (L" " );
111
+ result.append (quote_windows_arg (widen (commandvec[i])));
112
+ }
113
+ return result;
114
+ }
115
+ #endif
116
+
104
117
piped_processt::piped_processt (const std::vector<std::string> commandvec)
105
118
{
106
119
// Default state
@@ -193,13 +206,7 @@ piped_processt::piped_processt(const std::vector<std::string> commandvec)
193
206
start_info.hStdOutput = child_std_OUT_Wr;
194
207
start_info.hStdInput = child_std_IN_Rd;
195
208
start_info.dwFlags |= STARTF_USESTDHANDLES;
196
- // Unpack the command into a single string for Windows API
197
- std::wstring cmdline = widen (commandvec[0 ]);
198
- for (int i = 1 ; i < commandvec.size (); i++)
199
- {
200
- cmdline.append (L" " );
201
- cmdline.append (quote_windows_arg (widen (commandvec[i])));
202
- }
209
+ const std::wstring cmdline = process_windows_args (commandvec);
203
210
// Note that we do NOT free this since it becomes part of the child
204
211
// and causes heap corruption in Windows if we free!
205
212
const BOOL success = CreateProcessW (
You can’t perform that action at this time.
0 commit comments