SCP: Avoid 'not found' error in tool path locater on Windows
This commit is contained in:
parent
0bc77c4d90
commit
2834bfb1f9
1 changed files with 3 additions and 1 deletions
4
scp.c
4
scp.c
|
@ -6405,13 +6405,15 @@ FILE *f;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define FIND_CMD "where"
|
#define FIND_CMD "where"
|
||||||
|
#define FIND_CMD2 "2>NUL"
|
||||||
#define popen _popen
|
#define popen _popen
|
||||||
#define pclose _pclose
|
#define pclose _pclose
|
||||||
#else
|
#else
|
||||||
#define FIND_CMD "which"
|
#define FIND_CMD "which"
|
||||||
|
#define FIND_CMD2 ""
|
||||||
#endif
|
#endif
|
||||||
memset (toolpath, 0, sizeof(toolpath));
|
memset (toolpath, 0, sizeof(toolpath));
|
||||||
snprintf (findcmd, sizeof (findcmd), "%s %s", FIND_CMD, tool);
|
snprintf (findcmd, sizeof (findcmd), "%s %s %s", FIND_CMD, tool, FIND_CMD2);
|
||||||
if ((f = popen (findcmd, "r"))) {
|
if ((f = popen (findcmd, "r"))) {
|
||||||
do {
|
do {
|
||||||
if (NULL == fgets (toolpath, sizeof(toolpath)-1, f))
|
if (NULL == fgets (toolpath, sizeof(toolpath)-1, f))
|
||||||
|
|
Loading…
Add table
Reference in a new issue