Nicolae Brinza has proposed merging lp:~zorba-coders/zorba/process-2 into 
lp:zorba/process-module.

Commit message:
Changed module's errors to the new modules guidelines; Potential fix for 
execvpe() on Macs

Requested reviews:
  Nicolae Brinza (nbrinza)
  Ghislain Fourny (gislenius)
Related bugs:
  Bug #1188053 in Zorba: "Update non-core module "process""
  https://bugs.launchpad.net/zorba/+bug/1188053

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/process-2/+merge/171824

Changed module's errors to the new modules guidelines; Potential fix for 
execvpe() on Macs
-- 
https://code.launchpad.net/~zorba-coders/zorba/process-2/+merge/171824
Your team Zorba Coders is subscribed to branch lp:zorba/process-module.
=== modified file 'src/process-2.xq'
--- src/process-2.xq	2013-06-15 19:46:05 +0000
+++ src/process-2.xq	2013-06-27 14:46:36 +0000
@@ -26,8 +26,8 @@
  : <p>
  : Example:
  : <pre>
- :   import module namespace proc = "http://zorba.io/modules/process";;
- :   proc:exec("ls")
+ :   import module namespace p = "http://zorba.io/modules/process";;
+ :   p:exec("ls")
  : </pre>
  : </p>
  :
@@ -86,7 +86,7 @@
  :
  : @return the result of the execution as an object
  :
- : @error p:PROC01 if an error occurred while communicating with the process.
+ : @error p:COMMUNICATION if an error occurred while communicating with the process.
  :)
 declare %an:sequential function p:exec(
   $filename as string
@@ -113,7 +113,7 @@
  :
  : @return the result of the execution as an object
  :
- : @error p:PROC01 if an error occurred while communicating with the process.
+ : @error p:COMMUNICATION if an error occurred while communicating with the process.
  :)
 declare %an:sequential function p:exec(
   $filename as string,
@@ -147,7 +147,7 @@
  :
  : @return the result of the execution as an object
  :
- : @error p:PROC01 if an error occurred while communicating with the process.
+ : @error p:COMMUNICATION if an error occurred while communicating with the process.
  :)
 declare %an:sequential function p:exec(
   $filename as string,
@@ -168,7 +168,7 @@
  :
  : @return the result of the execution as an object
  :
- : @error p:PROC01 if an error occurred while communicating with the process.
+ : @error p:COMMUNICATION if an error occurred while communicating with the process.
  :)
 declare %an:sequential function p:exec-command(
   $cmd as string
@@ -189,7 +189,7 @@
  :
  : @return the result of the execution as an object
  :
- : @error p:PROC01 if an error occurred while communicating with the process.
+ : @error p:COMMUNICATION if an error occurred while communicating with the process.
  :)
 declare %an:sequential function p:exec-command(
   $cmd as string,

=== modified file 'src/process-2.xq.src/process.cpp'
--- src/process-2.xq.src/process.cpp	2013-06-21 03:37:04 +0000
+++ src/process-2.xq.src/process.cpp	2013-06-27 14:46:36 +0000
@@ -51,12 +51,21 @@
 #ifndef WIN32
 int execvpe(const char *program, char **argv, char **envp)
 {
+<<<<<<< TREE
   extern char **environ;
   char **saved = environ;
   int rc;
   environ = envp;
   rc = execvp(program, argv);
   environ = saved;
+=======
+  clearenv();
+  int i = 0;
+  while (envp[i] != NULL)
+    putenv(envp[i++]);
+  
+  int rc = execvp(program, argv);
+>>>>>>> MERGE-SOURCE
   return rc;
 }
 #endif
@@ -105,8 +114,7 @@
   wsprintf(lErrorBuffer,TEXT("Process Error Code: %d - Message= %s"),GetLastError(), (TCHAR *)lpvMessageBuffer);
   LocalFree(lpvMessageBuffer);
   Item lQName = ProcessModule::getItemFactory()->createQName(
-    "http://www.zorba-xquery.com/modules/process";,
-    "PROC01");
+    "http://zorba.io/modules/process";, "COMMUNICATION");
 #ifdef UNICODE
   char error_str[1024];
   WideCharToMultiByte(CP_UTF8, 0, lErrorBuffer, -1, error_str, sizeof(error_str), NULL, NULL);
@@ -239,7 +247,7 @@
       || !CreatePipe(&lErrRead,&lStdErr,&lSecurityAttributes,1024*1024) // std::cerr >> lErrRead
     ){
     Item lQName = ProcessModule::getItemFactory()->createQName(
-      "http://www.zorba-xquery.com/modules/process";, "PROC01");
+      "http://zorba.io/modules/process";, "COMMUNICATION");
     throw USER_EXCEPTION(lQName,
       "Couldn't create one of std::cout/std::cerr pipe for child process execution."
     );
@@ -261,7 +269,7 @@
       lErrorMsg 
         << "Couldn't get exit code from child process. Executed command: '" << aCommand << "'.";
       Item lQName = ProcessModule::getItemFactory()->createQName(
-        "http://www.zorba-xquery.com/modules/process";, "PROC01");
+        "http://zorba.io/modules/process";, "COMMUNICATION");
       throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());
     }
   
@@ -451,7 +459,7 @@
     std::stringstream lErrorMsg;
     lErrorMsg << "Failed to execute the command (" << code << ")";
     Item lQName = ProcessModule::getItemFactory()->createQName(
-      "http://www.zorba-xquery.com/modules/process";, "PROC01");
+      "http://zorba.io/modules/process";, "COMMUNICATION");
     throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());
   }
   exit_code = code;
@@ -489,7 +497,7 @@
       std::stringstream lErrorMsg;
       lErrorMsg << "Failed to execute the command (" << pid << ")";
       Item lQName = ProcessModule::getItemFactory()->createQName(
-            "http://www.zorba-xquery.com/modules/process";, "PROC01");
+            "http://zorba.io/modules/process";, "COMMUNICATION");
       throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());
       return NULL;
     }
@@ -515,7 +523,7 @@
       std::stringstream lErrorMsg;
       lErrorMsg << "Failed to close the err stream (" << status << ")";
       Item lQName = ProcessModule::getItemFactory()->createQName(
-        "http://www.zorba-xquery.com/modules/process";, "PROC01");
+        "http://zorba.io/modules/process";, "COMMUNICATION");
       throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());
     }
 
@@ -528,7 +536,7 @@
         std::stringstream lErrorMsg;
         lErrorMsg << "Failed to wait for child process ";
         Item lQName = ProcessModule::getItemFactory()->createQName(
-          "http://www.zorba-xquery.com/modules/process";, "PROC01");
+          "http://zorba.io/modules/process";, "COMMUNICATION");
         throw USER_EXCEPTION(lQName, lErrorMsg.str().c_str());          
     }
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to