Fix up close to return proper exit code.

This commit is contained in:
Calvin Rose committed 2019-05-29 11:50:46 -04:00
1 parent af23040d9c
commit b39ad97a87
1 file changed
+2 -2
+2 -2
View File
@@ -288,8 +288,8 @@ static Janet cfun_io_fclose(int32_t argc, Janet *argv) {
#endif
int status = pclose(iof->file);
iof->flags |= IO_CLOSED;
if (status) janet_panic("could not close file");
return janet_wrap_integer(status);
if (status == -1) janet_panic("could not close file");
return janet_wrap_integer(WEXITSTATUS(status));
} else {
if (fclose(iof->file)) janet_panic("could not close file");
iof->flags |= IO_CLOSED;