1. python_mirrors
  2. features/py3k-cdecimal

Commits

Guido van Rossum  committed f7090f5

Use posix.popen to read output from a command instead if command.get*.

  • Participants
  • Parent commits 7f8756f
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Tools/scripts/xxci.py

View file
+#! /ufs/guido/bin/sgi/python
 #! /usr/local/python
 
 # xxci
 def go(args):
 	for file in args:
 		print file + ':'
-		if run('rcsdiff -c', file):
+		if differing(file):
+			sts = posix.system('rcsdiff ' + file) # ignored
 			if askyesno('Check in ' + file + ' ? '):
-				sts = run('rcs -l', file) # ignored
-				# can't use run() here because it's interactive
+				sts = posix.system('rcs -l ' + file) # ignored
 				sts = posix.system('ci -l ' + file)
 
-def run(cmd, file):
-	sts, output = commands.getstatusoutput(cmd + commands.mkarg(file))
-	if sts:
-		print output
-		print 'Exit status', sts
-	return sts
+def differing(file):
+	try:
+		this = open(file, 'r').read()
+		that = posix.popen('co -p '+file+' 2>/dev/null', 'r').read()
+		return this <> that
+	except:
+		return 1
 
 def askyesno(prompt):
 	s = raw_input(prompt)