Mercurial > hg > truffle
comparison mx/commands.py @ 8901:8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Mon, 08 Apr 2013 18:47:06 +0200 |
parents | 822163edb8bf |
children | 08a16c26907f |
comparison
equal
deleted
inserted
replaced
8900:822163edb8bf | 8901:8ddaac81cb21 |
---|---|
656 | 656 |
657 jvmCfg = _vmCfgInJdk(jdk) | 657 jvmCfg = _vmCfgInJdk(jdk) |
658 if not exists(jvmCfg): | 658 if not exists(jvmCfg): |
659 mx.abort(jvmCfg + ' does not exist') | 659 mx.abort(jvmCfg + ' does not exist') |
660 | 660 |
661 prefix = '-' + vm | 661 prefix = '-' + vm + ' ' |
662 vmKnown = prefix + ' KNOWN\n' | 662 vmKnown = prefix + 'KNOWN\n' |
663 lines = [] | 663 lines = [] |
664 found = False | 664 found = False |
665 with open(jvmCfg) as f: | 665 with open(jvmCfg) as f: |
666 for line in f: | 666 for line in f: |
667 if line.strip() == vmKnown.strip(): | 667 if line.strip() == vmKnown.strip(): |
668 found = True | 668 found = True |
669 lines.append(line) | 669 lines.append(line) |
670 | 670 |
671 if not found: | 671 if not found: |
672 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg) | 672 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) |
673 if mx.get_os() != 'windows': | 673 if mx.get_os() != 'windows': |
674 os.chmod(jvmCfg, 0755) | 674 os.chmod(jvmCfg, 0755) |
675 with open(jvmCfg, 'w') as f: | 675 with open(jvmCfg, 'w') as f: |
676 for line in lines: | 676 for line in lines: |
677 if line.startswith(prefix): | 677 if line.startswith(prefix): |