Reopens an already open file and changes the execute bit to match the execute bit setting in the passed in mode.
(file, mode)
| 681 | |
| 682 | |
| 683 | def setP4ExecBit(file, mode): |
| 684 | """Reopens an already open file and changes the execute bit to match the |
| 685 | execute bit setting in the passed in mode. |
| 686 | """ |
| 687 | |
| 688 | p4Type = "+x" |
| 689 | |
| 690 | if not isModeExec(mode): |
| 691 | p4Type = getP4OpenedType(file) |
| 692 | p4Type = re.sub(r'^([cku]?)x(.*)', r'\1\2', p4Type) |
| 693 | p4Type = re.sub(r'(.*?\+.*?)x(.*?)', r'\1\2', p4Type) |
| 694 | if p4Type[-1] == "+": |
| 695 | p4Type = p4Type[0:-1] |
| 696 | |
| 697 | p4_reopen(p4Type, file) |
| 698 | |
| 699 | |
| 700 | def getP4OpenedType(file): |
no test coverage detected