Commit a5f194c7 authored by Guido van Rossum's avatar Guido van Rossum

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

parent 40b00bbe
#! /ufs/guido/bin/sgi/python
#! /usr/local/python #! /usr/local/python
# xxci # xxci
...@@ -57,18 +58,19 @@ def badsuffix(file): ...@@ -57,18 +58,19 @@ def badsuffix(file):
def go(args): def go(args):
for file in args: for file in args:
print file + ':' print file + ':'
if run('rcsdiff -c', file): if differing(file):
sts = posix.system('rcsdiff ' + file) # ignored
if askyesno('Check in ' + file + ' ? '): if askyesno('Check in ' + file + ' ? '):
sts = run('rcs -l', file) # ignored sts = posix.system('rcs -l ' + file) # ignored
# can't use run() here because it's interactive
sts = posix.system('ci -l ' + file) sts = posix.system('ci -l ' + file)
def run(cmd, file): def differing(file):
sts, output = commands.getstatusoutput(cmd + commands.mkarg(file)) try:
if sts: this = open(file, 'r').read()
print output that = posix.popen('co -p '+file+' 2>/dev/null', 'r').read()
print 'Exit status', sts return this <> that
return sts except:
return 1
def askyesno(prompt): def askyesno(prompt):
s = raw_input(prompt) s = raw_input(prompt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment