mirror of
https://github.com/janet-lang/janet
synced 2024-11-29 03:19:54 +00:00
Fix up close to return proper exit code.
This commit is contained in:
parent
af23040d9c
commit
b39ad97a87
@ -288,8 +288,8 @@ static Janet cfun_io_fclose(int32_t argc, Janet *argv) {
|
|||||||
#endif
|
#endif
|
||||||
int status = pclose(iof->file);
|
int status = pclose(iof->file);
|
||||||
iof->flags |= IO_CLOSED;
|
iof->flags |= IO_CLOSED;
|
||||||
if (status) janet_panic("could not close file");
|
if (status == -1) janet_panic("could not close file");
|
||||||
return janet_wrap_integer(status);
|
return janet_wrap_integer(WEXITSTATUS(status));
|
||||||
} else {
|
} else {
|
||||||
if (fclose(iof->file)) janet_panic("could not close file");
|
if (fclose(iof->file)) janet_panic("could not close file");
|
||||||
iof->flags |= IO_CLOSED;
|
iof->flags |= IO_CLOSED;
|
||||||
|
Loading…
Reference in New Issue
Block a user