* This wrapper is a workaround for a funny _popen() feature on Windows * where it eats external quotes in some cases. The bug seems to be related * to the quote stripping functionality used by the Windows cmd.exe * interpreter when its /S is not specified. * * Cleaned up quote from the cmd.exe help screen as displayed on Windows XP * SP3: * * 1. If all of
| 2335 | * (03.06.2008.) (Jurko) |
| 2336 | */ |
| 2337 | static FILE * windows_popen_wrapper( char const * command, |
| 2338 | char const * mode ) |
| 2339 | { |
| 2340 | int const extra_command_quotes_needed = !!strchr( command, '"' ); |
| 2341 | string quoted_command; |
| 2342 | FILE * result; |
| 2343 | |
| 2344 | if ( extra_command_quotes_needed ) |
| 2345 | { |
| 2346 | string_new( "ed_command ); |
| 2347 | string_append( "ed_command, "\"" ); |
| 2348 | string_append( "ed_command, command ); |
| 2349 | string_append( "ed_command, "\"" ); |
| 2350 | command = quoted_command.value; |
| 2351 | } |
| 2352 | |
| 2353 | result = _popen( command, "r" ); |
| 2354 | |
| 2355 | if ( extra_command_quotes_needed ) |
| 2356 | string_free( "ed_command ); |
| 2357 | |
| 2358 | return result; |
| 2359 | } |
| 2360 | #endif /* defined(_MSC_VER) || defined(__BORLANDC__) */ |
| 2361 | |
| 2362 |
nothing calls this directly
no test coverage detected