[Swift-commit] r4928 - SwiftApps/GOSwift/pykoa/tools
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Tue Aug 2 10:42:49 CDT 2011
Author: jonmon
Date: 2011-08-02 10:42:48 -0500 (Tue, 02 Aug 2011)
New Revision: 4928
Modified:
SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py
Log:
o use the subprocess module instead of the commands module in koa_goswift_list.py
Modified: SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py
===================================================================
--- SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py 2011-08-02 15:25:07 UTC (rev 4927)
+++ SwiftApps/GOSwift/pykoa/tools/koa_goswift_list.py 2011-08-02 15:42:48 UTC (rev 4928)
@@ -1,6 +1,6 @@
import os
import sys
-import commands
+import subprocess
import pykoa
import pykoa.tools
@@ -29,15 +29,17 @@
return 1
run_directory = os.environ["HOME"]+"/Swift";
+ cmd = "/bin/ls -lGht "+run_directory+" | awk '{print $2, $3, $4, $5, $6, $7, $8}'"
- (status, output) = commands.getstatusoutput( "/bin/ls " + run_directory )
+ ret = subprocess.call(cmd, close_fds=True,
+ shell=True)
- if status != 0:
+
+ if ret != 0:
sys.stderr.write( "FAILED TO LIST DIRECTORY\n" )
- pykoa.debug("Listing directory failed with error code: "+str(status) + ": /bin/ls " + run_directory)
- return status
+ pykoa.debug("Listing directory failed with error code: "+str(ret) + ": /bin/ls -lGht -w" + run_directory)
+ return ret
- sys.stdout.write( output+"\n" )
return 0
if __name__ == "__main__":
More information about the Swift-commit
mailing list