Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fa5a7f

Browse files
committed
Use posix.popen to read output from a command instead if command.get*.
1 parent 9c5c808 commit 2fa5a7f

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

Tools/scripts/xxci.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! /ufs/guido/bin/sgi/python
12
#! /usr/local/python
23

34
# xxci
@@ -57,18 +58,19 @@ def badsuffix(file):
5758
def go(args):
5859
for file in args:
5960
print file + ':'
60-
if run('rcsdiff -c', file):
61+
if differing(file):
62+
sts = posix.system('rcsdiff ' + file) # ignored
6163
if askyesno('Check in ' + file + ' ? '):
62-
sts = run('rcs -l', file) # ignored
63-
# can't use run() here because it's interactive
64+
sts = posix.system('rcs -l ' + file) # ignored
6465
sts = posix.system('ci -l ' + file)
6566

66-
def run(cmd, file):
67-
sts, output = commands.getstatusoutput(cmd + commands.mkarg(file))
68-
if sts:
69-
print output
70-
print 'Exit status', sts
71-
return sts
67+
def differing(file):
68+
try:
69+
this = open(file, 'r').read()
70+
that = posix.popen('co -p '+file+' 2>/dev/null', 'r').read()
71+
return this <> that
72+
except:
73+
return 1
7274

7375
def askyesno(prompt):
7476
s = raw_input(prompt)

0 commit comments

Comments
 (0)