https://github.com/katahiromz/win_popen_bug
Windows _popen bug
https://github.com/katahiromz/win_popen_bug
bug pipeline win32 win32api windows windows-10
Last synced: 7 months ago
JSON representation
Windows _popen bug
- Host: GitHub
- URL: https://github.com/katahiromz/win_popen_bug
- Owner: katahiromz
- License: mit
- Created: 2021-03-22T12:18:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-22T12:50:41.000Z (over 4 years ago)
- Last Synced: 2025-01-12T22:30:38.369Z (9 months ago)
- Topics: bug, pipeline, win32, win32api, windows, windows-10
- Language: C
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Windows _popen bug found by @katahiromz
The following code works:
```c
fp = _popen("cmdline.exe \"--test=TE ST\"", "rb"); /* SUCCESSFUL */
if (fp)
{
while (fgets(buf, 256, fp))
{
fputs(buf, stdout);
}
_pclose(fp);
}
else
{
fprintf(stderr, "ERROR: Cannot execute 'cmdline.exe'\n");
return -1;
}
```And then, the next code also works:
```c
fp = _popen("\"cm dline.exe\" --test=TEST", "rb"); /* SUCCESSFUL */
if (fp)
{
while (fgets(buf, 256, fp))
{
fputs(buf, stdout);
}
_pclose(fp);
}
else
{
fprintf(stderr, "ERROR: Cannot execute 'cm dline.exe'\n");
return -2;
}
```But, the following code won't work:
```c
fp = _popen("\"cm dline.exe\" \"--test=TE ST\"", "rb"); /* BUG: this is failed */
if (fp)
{
while (fgets(buf, 256, fp))
{
fputs(buf, stdout);
}
_pclose(fp);
}
else
{
fprintf(stderr, "ERROR: Cannot execute 'cm dline.exe'\n");
return -3;
}
```