working on contrib/process

erg 2006-10-20 21:55:08 +00:00
parent 249ba7d71c
commit 2228c9fe54
4 changed files with 33 additions and 7 deletions

View File

@ -0,0 +1,7 @@
IN: process
USING: kernel ;
PROVIDE: contrib/process {
{ "os-unix.factor" [ unix? ] }
{ "os-windows.factor" [ windows? ] }
"process.factor"
} ;

View File

@ -0,0 +1,11 @@
IN: process
USING: compiler io io-internals kernel parser generic ;
LIBRARY: libc
FUNCTION: int system ( char* command ) ;
FUNCTION: void* popen ( char* command, char* type ) ;
FUNCTION: int pclose ( void* file ) ;
: run-process ( string -- ) system io-error ;
: run-detached ( string -- ) " &" append run-process ;

View File

@ -0,0 +1,15 @@
IN: process
USING: alien compiler io io-internals kernel math parser generic win32-api ;
: (run-process) ( string flag -- )
>r f swap
f f 0 r> f f
"STARTUPINFO" <c-object> "STARTUPINFO" c-size over set-STARTUPINFO-cb
"PROCESS_INFORMATION" <c-object> CreateProcess zero? [ win32-error ] when ;
: run-process
0 (run-process) ;
: run-detached ( string -- )
DETACH_PROCESS (run-process) ;

View File

@ -1,12 +1,6 @@
IN: process IN: process
USING: compiler io io-internals kernel parser generic ; USING: compiler io io-internals kernel parser generic ;
LIBRARY: libc
FUNCTION: int system ( char* command ) ;
FUNCTION: void* popen ( char* command, char* type ) ;
FUNCTION: int pclose ( void* file ) ;
TUPLE: process-stream pipe ; TUPLE: process-stream pipe ;
C: process-stream ( command mode -- stream ) C: process-stream ( command mode -- stream )
@ -20,4 +14,3 @@ M: process-stream stream-close
: !" parse-string system drop ; parsing : !" parse-string system drop ; parsing
PROVIDE: contrib/process ;