diff --git a/libs/base/System.idr b/libs/base/System.idr index c24ab5043..0a7ccd8ae 100644 --- a/libs/base/System.idr +++ b/libs/base/System.idr @@ -180,6 +180,7 @@ time : HasIO io => io Integer time = pure $ cast !(primIO prim__time) %foreign support "idris2_getPID" + "node:lambda:() => process.pid" prim__getPID : PrimIO Int ||| Get the ID of the currently running process. diff --git a/tests/Main.idr b/tests/Main.idr index 18a9e49fe..2a18f3e8c 100644 --- a/tests/Main.idr +++ b/tests/Main.idr @@ -271,7 +271,7 @@ nodeTests = MkTestPool "Node backend" [] (Just Node) [ "node001", "node002", "node003", "node004", "node005", "node006" , "node007", "node008", "node009", "node011", "node012", "node015" , "node017", "node018", "node019", "node021", "node022", "node023" - , "node024", "node025", "node026" + , "node024", "node025", "node026", "node027" , "perf001" -- , "node14", "node020" , "args" diff --git a/tests/node/node027/PID.idr b/tests/node/node027/PID.idr new file mode 100644 index 000000000..1b9d34469 --- /dev/null +++ b/tests/node/node027/PID.idr @@ -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 diff --git a/tests/node/node027/expected b/tests/node/node027/expected new file mode 100644 index 000000000..c1247394a --- /dev/null +++ b/tests/node/node027/expected @@ -0,0 +1,2 @@ +1/1: Building PID (PID.idr) +Main> Main> Bye for now! diff --git a/tests/node/node027/input b/tests/node/node027/input new file mode 100644 index 000000000..fc5992c29 --- /dev/null +++ b/tests/node/node027/input @@ -0,0 +1,2 @@ +:exec main +:q diff --git a/tests/node/node027/run b/tests/node/node027/run new file mode 100644 index 000000000..fc557d93b --- /dev/null +++ b/tests/node/node027/run @@ -0,0 +1,3 @@ +rm -rf build + +$1 --cg node --no-banner --no-color --console-width 0 PID.idr < input