Skip to content

Commit a864bb8

Browse files
committed
Test communication over special device
1 parent cee1d8f commit a864bb8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/Test.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
module Main where
44

55
import qualified Data.ByteString as BS
6+
import System.IO (openBinaryFile, IOMode(..))
7+
import Control.Concurrent
68

79
main = do
810
putStrLn "Hello from jsaddle-wasm-test"
11+
12+
out <- openBinaryFile "/dev/jsaddle_out" WriteMode
13+
-- in <- openBinaryFile "/dev/jsaddle_in" ReadMode
14+
15+
BS.hPut out "Hello jsaddle"
16+
BS.hPut out "More data to jsaddle"
17+
18+
forkIO $ do
19+
BS.hPut out "Data from forked thread"
20+
threadDelay 1000
21+
BS.hPut out "Data from forked thread2"
22+
23+
BS.hPut out "More data from Main thread"
24+
threadDelay 1000
25+
BS.hPut out "More data from Main thread2"
26+
27+
putStrLn "Done"

0 commit comments

Comments
 (0)