From 2a48e335db1ce4e649cb05895c85923740973899 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Wed, 6 May 2015 14:04:37 +0200 Subject: Access to file descriptors --- TODO | 1 + elymas/lib/sys.ey | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 83b46da..a27f07b 100644 --- a/TODO +++ b/TODO @@ -16,3 +16,4 @@ * input prompt * better interactive error handling when interpreting from stdin * document ALL THE LIBRARIES +* consider https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system and finally make the stuff typed correctly diff --git a/elymas/lib/sys.ey b/elymas/lib/sys.ey index 8f128cb..fe4f4b6 100644 --- a/elymas/lib/sys.ey +++ b/elymas/lib/sys.ey @@ -49,7 +49,7 @@ # 0 -> a shell command { ==cmd - "/bin/sh" [ "sh" "-c" cmd "\0" cat ] [ ] +execve ??proc.exec + "/bin/sh" [ "sh" "-c" cmd ] { "\0" cat } '*0.0 [ ] +execve ??proc.exec } /shell sys .deff # 0 -> function to execute in the child @@ -79,9 +79,9 @@ child < ==pid { pid 0 +waitpid -- } =*wait { pid -01 +kill -- } =*kill - writeA sys .fdToFile _ .writeonly ==in - readB sys .fdToFile _ .readonly ==out - readC sys .fdToFile _ .readonly ==err + writeA _ ==inFd sys .fdToFile _ .writeonly ==in + readB _ ==outFd sys .fdToFile _ .readonly ==out + readC _ ==errFd sys .fdToFile _ .readonly ==err > } ? * } /spawn sys .deff -- cgit v1.2.3