Fix APE error if unable to modify self

See PR #96 and issue #85
This commit is contained in:
tomberek 2021-03-02 00:13:22 -05:00 committed by GitHub
parent f4298f10c2
commit 0eaad9dd7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -573,6 +573,8 @@ apesh: .ascii "'\n#'\"\n" # sixth edition shebang
.shstub ape_elf_shstrndx,2 # 3e: e_shstrndx
.ascii "' >&7\n"
.ascii "exec 7<&-\n"
.ascii "else\n"
.ascii "exit 1\n"
.ascii "fi\n"
.ascii "exec \"$0\" \"$@\"\n" # etxtbsy tail recursion
.ascii "R=$?\n" # architecture optimistic