[ nodejs ] pid

This commit is contained in:
alissa-tung 2021-12-22 22:25:21 +08:00
parent 3c532ea35d
commit 158cb1c75e
6 changed files with 19 additions and 1 deletions

View File

@ -180,6 +180,7 @@ time : HasIO io => io Integer
time = pure $ cast !(primIO prim__time) time = pure $ cast !(primIO prim__time)
%foreign support "idris2_getPID" %foreign support "idris2_getPID"
"node:lambda:() => process.pid"
prim__getPID : PrimIO Int prim__getPID : PrimIO Int
||| Get the ID of the currently running process. ||| Get the ID of the currently running process.

View File

@ -271,7 +271,7 @@ nodeTests = MkTestPool "Node backend" [] (Just Node)
[ "node001", "node002", "node003", "node004", "node005", "node006" [ "node001", "node002", "node003", "node004", "node005", "node006"
, "node007", "node008", "node009", "node011", "node012", "node015" , "node007", "node008", "node009", "node011", "node012", "node015"
, "node017", "node018", "node019", "node021", "node022", "node023" , "node017", "node018", "node019", "node021", "node022", "node023"
, "node024", "node025", "node026" , "node024", "node025", "node026", "node027"
, "perf001" , "perf001"
-- , "node14", "node020" -- , "node14", "node020"
, "args" , "args"

View File

@ -0,0 +1,10 @@
import System
assert : Bool -> IO ()
assert b = if b
then pure ()
else assert_total $ idris_crash ""
main : IO ()
main = do
assert $ !getPID /= 0

View File

@ -0,0 +1,2 @@
1/1: Building PID (PID.idr)
Main> Main> Bye for now!

2
tests/node/node027/input Normal file
View File

@ -0,0 +1,2 @@
:exec main
:q

3
tests/node/node027/run Normal file
View File

@ -0,0 +1,3 @@
rm -rf build
$1 --cg node --no-banner --no-color --console-width 0 PID.idr < input