ObjFW  Check-in [3f56716b3d]

Overview
Comment:OFSubprocess: Fix dealloc after -[closeForWriting]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3f56716b3d22f509f32efa88731906b07392380f33cbbe4653dfcf643b8c6d53
User & Date: js on 2024-01-21 09:55:44
Other Links: manifest | tags
Context
2024-01-21
10:10
Add tests for OFSubprocess check-in: 02824cb820 user: js tags: trunk
09:56
OFSubprocess: Fix dealloc after -[closeForWriting] check-in: 9882a09715 user: js tags: 1.0
09:55
OFSubprocess: Fix dealloc after -[closeForWriting] check-in: 3f56716b3d user: js tags: trunk
09:38
OFSubprocess: Correctly handle nil environment check-in: 6ca56b4f15 user: js tags: trunk
Changes

Modified src/platform/POSIX/OFSubprocess.m from [de1f50a841] to [b319d33b6e].

373
374
375
376
377
378
379

380

381
382
383
384
385
386
387
}

- (void)close
{
	if (_readPipe[0] == -1)
		@throw [OFNotOpenException exceptionWithObject: self];


	[self closeForWriting];

	close(_readPipe[0]);

	if (_pid != -1) {
		kill(_pid, SIGTERM);
		waitpid(_pid, &_status, WNOHANG);
	}








>
|
>







373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
}

- (void)close
{
	if (_readPipe[0] == -1)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_writePipe[1] != -1)
		[self closeForWriting];

	close(_readPipe[0]);

	if (_pid != -1) {
		kill(_pid, SIGTERM);
		waitpid(_pid, &_status, WNOHANG);
	}

Modified src/platform/Windows/OFSubprocess.m from [3257d0230c] to [4e382dab1b].

379
380
381
382
383
384
385

386

387
388
389
390
391
392
393
}

- (void)close
{
	if (_readPipe[0] == NULL)
		@throw [OFNotOpenException exceptionWithObject: self];


	[self closeForWriting];

	CloseHandle(_readPipe[0]);

	if (_handle != INVALID_HANDLE_VALUE) {
		TerminateProcess(_handle, 0);
		CloseHandle(_handle);
	}








>
|
>







379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
}

- (void)close
{
	if (_readPipe[0] == NULL)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_writePipe[1] != NULL)
		[self closeForWriting];

	CloseHandle(_readPipe[0]);

	if (_handle != INVALID_HANDLE_VALUE) {
		TerminateProcess(_handle, 0);
		CloseHandle(_handle);
	}