Merge pull request #266 from andrewchambers/idempotentclose

Make file/close idempotent.
This commit is contained in:
Calvin Rose 2020-01-21 10:16:06 -06:00 committed by GitHub
commit 01c6ffe1d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -290,7 +290,7 @@ static Janet cfun_io_fclose(int32_t argc, Janet *argv) {
janet_fixarity(argc, 1);
IOFile *iof = janet_getabstract(argv, 0, &cfun_io_filetype);
if (iof->flags & JANET_FILE_CLOSED)
janet_panic("file is closed");
return janet_wrap_nil();
if (iof->flags & (JANET_FILE_NOT_CLOSEABLE))
janet_panic("file not closable");
if (iof->flags & JANET_FILE_PIPED) {