Differences From Artifact [a980832db2]:
- File
src/OFProcess.m
— part of check-in
[4f36894ce7]
at
2017-06-05 17:36:28
on branch trunk
— Clean up exceptions a little
This removes several initializers that omitted the errNo. Removing those
forces to think about whether there is a meaningful errNo to set instead
of just omitting it. (user: js, size: 14117) [annotate] [blame] [check-ins using]
To Artifact [b2487462e5]:
- File
src/OFProcess.m
— part of check-in
[2ae01218ef]
at
2017-06-12 22:29:41
on branch trunk
— OFWriteFailedException: Add -[bytesWritten]
This allows retrieving the number of bytes already written before the
write failed, allowing to retry without writing data that has already
been written. (user: js, size: 14385) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
484 485 486 487 488 489 490 491 492 493 494 495 496 | return ret; } - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { #ifndef OF_WINDOWS if (_writePipe[1] == -1) @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; | > > | > | | | > > > > > > > | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | return ret; } - (void)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { #ifndef OF_WINDOWS ssize_t bytesWritten; if (_writePipe[1] == -1) @throw [OFNotOpenException exceptionWithObject: self]; if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if ((bytesWritten = write(_writePipe[1], buffer, length)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: errno]; #else DWORD bytesWritten; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; if (_writePipe[1] == NULL) @throw [OFNotOpenException exceptionWithObject: self]; if (!WriteFile(_writePipe[1], buffer, (DWORD)length, &bytesWritten, NULL)) { int errNo = EIO; if (GetLastError() == ERROR_BROKEN_PIPE) errNo = EPIPE; @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: errNo]; } #endif if ((size_t)bytesWritten != length) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: bytesWritten errNo: 0]; } - (int)fileDescriptorForReading { #ifndef OF_WINDOWS return _readPipe[0]; #else |
︙ | ︙ |