mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Merge pull request #905 from ishehadeh/master
Fix typo in janet_epoll_sync_callback, add test for "async" read from normal fd
This commit is contained in:
		| @@ -1434,7 +1434,7 @@ static void janet_epoll_sync_callback(JanetEVGenericMessage msg) { | |||||||
|     JanetAsyncStatus status2 = JANET_ASYNC_STATUS_NOT_DONE; |     JanetAsyncStatus status2 = JANET_ASYNC_STATUS_NOT_DONE; | ||||||
|     if (state->stream->_mask & JANET_ASYNC_LISTEN_WRITE) |     if (state->stream->_mask & JANET_ASYNC_LISTEN_WRITE) | ||||||
|         status1 = state->machine(state, JANET_ASYNC_EVENT_WRITE); |         status1 = state->machine(state, JANET_ASYNC_EVENT_WRITE); | ||||||
|     if (state->stream->_mask & JANET_ASYNC_LISTEN_WRITE) |     if (state->stream->_mask & JANET_ASYNC_LISTEN_READ) | ||||||
|         status2 = state->machine(state, JANET_ASYNC_EVENT_READ); |         status2 = state->machine(state, JANET_ASYNC_EVENT_READ); | ||||||
|     if (status1 == JANET_ASYNC_STATUS_DONE || |     if (status1 == JANET_ASYNC_STATUS_DONE || | ||||||
|             status2 == JANET_ASYNC_STATUS_DONE) { |             status2 == JANET_ASYNC_STATUS_DONE) { | ||||||
|   | |||||||
| @@ -115,6 +115,19 @@ | |||||||
|    # Cast to string to enable comparison |    # Cast to string to enable comparison | ||||||
|    (assert (= "123\n456\n" (string (slurp "unique.txt"))) "File writing 4.2") |    (assert (= "123\n456\n" (string (slurp "unique.txt"))) "File writing 4.2") | ||||||
|    (os/rm "unique.txt")) |    (os/rm "unique.txt")) | ||||||
|  |  | ||||||
|  | # Test that the stream created by os/open can be read from | ||||||
|  | (assert-no-error "File reading 1.1" | ||||||
|  |   (def outstream (os/open "unique.txt" :wct)) | ||||||
|  |   (defer (:close outstream) | ||||||
|  |     (:write outstream "123\n") | ||||||
|  |     (:write outstream "456\n")) | ||||||
|  |      | ||||||
|  |   (def outstream (os/open "unique.txt" :r)) | ||||||
|  |   (defer (:close outstream) | ||||||
|  |     (assert (= "123\n456\n" (string (:read outstream :all))) "File reading 1.2")) | ||||||
|  |   (os/rm "unique.txt")) | ||||||
|  |       | ||||||
|       |       | ||||||
| # ev/gather | # ev/gather | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose