Fix #29 LinuxApplication passing a list of files as 'sources' not working
[nepi.git] / src / nepi / util / execfuncs.py
index 773465c..b25ae98 100644 (file)
@@ -17,7 +17,7 @@
 #
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
-from nepi.util.sshfuncs import RUNNING, FINISHED, NOT_STARTED, STDOUT 
+from nepi.util.sshfuncs import ProcStatus, STDOUT
 
 import subprocess
 
@@ -40,13 +40,14 @@ def lexec(command,
     elif user:
         command = "su %s ; %s " % (user, command)
 
+
     p = subprocess.Popen(command, 
             stdout = subprocess.PIPE, 
             stderr = subprocess.PIPE,
             stdin  = stdin)
 
     out, err = p.communicate()
-    return ((out, err), proc)
+    return (out, err)
 
 def lcopy(source, dest, recursive = False):
     """
@@ -59,10 +60,17 @@ def lcopy(source, dest, recursive = False):
     command = ["cp"]
     if recursive:
         command.append("-R")
-    
-    command.append(src)
-    command.append(dst)
-    
+  
+    if isinstance(dest, str):
+        dest = dest.split(";")
+
+    if isinstance(src, str):
+        src = src.split(";")
+           
+    args.extend(src)
+
+    args.extend(dest)
+
     p = subprocess.Popen(command, 
         stdout=subprocess.PIPE, 
         stderr=subprocess.PIPE)
@@ -134,7 +142,7 @@ def lspawn(command, pidfile,
 
     return (out,err),proc
 
-def lcheckpid(pidfile):
+def lgetpid(pidfile):
     """
     Check the pidfile of a process spawned with remote_spawn.
     
@@ -179,14 +187,14 @@ def lstatus(pid, ppid):
         })
     
     if proc.wait():
-        return NOT_STARTED
+        return ProcStatus.NOT_STARTED
     
     status = False
     if out:
         status = (out.strip() == 'wait')
     else:
-        return NOT_STARTED
-    return RUNNING if status else FINISHED
+        return ProcStatus.NOT_STARTED
+    return ProcStatus.RUNNING if status else ProcStatus.FINISHED
  
 
 def lkill(pid, ppid, sudo = False):