Browse Source

Merge pull request #9977 from richardkchapman/ecl-bundle-path

HPCC-17426 Windows not finding "ecl bundle" command

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 8 years ago
parent
commit
203a9c7821
1 changed files with 7 additions and 3 deletions
  1. 7 3
      ecl/eclcmd/eclcmd_shell.cpp

+ 7 - 3
ecl/eclcmd/eclcmd_shell.cpp

@@ -51,13 +51,17 @@ int EclCMDShell::callExternal(ArgvIterator &iter)
         argv[i++]=iter.query();
     argv[i]=NULL;
 //TODO - add common routine or use existing in jlib
-#ifdef _WIN32
-    if (_spawnvp(_P_WAIT, cmdstr.str(), const_cast<char **>(argv))==-1)
-#else
     // First try in same dir as the ecl executable
     StringBuffer local;
     splitFilename(queryCurrentProcessPath(), &local, &local, NULL, NULL);
     local.append(cmdstr);
+    errno = 0;
+#ifdef _WIN32
+    if (_spawnvp(_P_WAIT, local.str(), const_cast<char **>(argv))==-1)
+        return 0;
+    // If not found, try the path
+    if (errno!=ENOENT || _spawnvp(cmdstr.str(), const_cast<char **>(argv))==-1)
+#else
     if (execvp(local.str(), const_cast<char **>(argv))!=-1)
         return 0;
     // If not found, try the path