comparison mx/commands.py @ 8180:0934903d28f3

use shutil.move to make concurrent updating/replacement of graal.jar atomic
author Doug Simon <doug.simon@oracle.com>
date Fri, 08 Mar 2013 15:55:37 +0100
parents 8d10fc6b4f6c
children e0db99483b35
comparison
equal deleted inserted replaced
8179:80a825206cbc 8180:0934903d28f3
383 jdks = join(_graal_home, 'jdk' + str(mx.java().version)) 383 jdks = join(_graal_home, 'jdk' + str(mx.java().version))
384 if exists(jdks): 384 if exists(jdks):
385 for e in os.listdir(jdks): 385 for e in os.listdir(jdks):
386 jreLibDir = join(jdks, e, 'jre', 'lib') 386 jreLibDir = join(jdks, e, 'jre', 'lib')
387 if exists(jreLibDir): 387 if exists(jreLibDir):
388 shutil.copyfile(graalJar, join(jreLibDir, 'graal.jar')) 388 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE
389 _, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir)
390 shutil.copyfile(graalJar, tmp)
391 shutil.move(tmp, join(jreLibDir, 'graal.jar'))
389 392
390 # run a command in the windows SDK Debug Shell 393 # run a command in the windows SDK Debug Shell
391 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}): 394 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
392 newLine = os.linesep 395 newLine = os.linesep
393 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE' 396 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE'