浏览代码

HPCC-17426 Windows not finding "ecl bundle" command

Use same logic as Linux to search current executable location first.
Note that Windows searches current executable directory by default when
localing dll files, but this does not (it seems) apply when loading
executables.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 年之前
父节点
当前提交
dbd8ebda08
共有 1 个文件被更改,包括 7 次插入3 次删除
  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++]=iter.query();
     argv[i]=NULL;
     argv[i]=NULL;
 //TODO - add common routine or use existing in jlib
 //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
     // First try in same dir as the ecl executable
     StringBuffer local;
     StringBuffer local;
     splitFilename(queryCurrentProcessPath(), &local, &local, NULL, NULL);
     splitFilename(queryCurrentProcessPath(), &local, &local, NULL, NULL);
     local.append(cmdstr);
     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)
     if (execvp(local.str(), const_cast<char **>(argv))!=-1)
         return 0;
         return 0;
     // If not found, try the path
     // If not found, try the path