Handle inheritance fixes for tools.deploy.test.5

db4
U-SLAVA-DFB8FF805\Slava 2008-06-27 19:26:36 -05:00
parent aed0909c55
commit 366d7009b8
7 changed files with 21 additions and 12 deletions

8
extra/io/sockets/secure/secure-tests.factor Normal file → Executable file
View File

@ -2,3 +2,11 @@ IN: io.sockets.secure.tests
USING: accessors kernel io.sockets io.sockets.secure tools.test ;
[ "hello" 24 ] [ "hello" 24 <inet> <secure> [ host>> ] [ port>> ] bi ] unit-test
[ ] [
<secure-config>
"resource:extra/openssl/test/server.pem" >>key-file
"resource:extra/openssl/test/dh1024.pem" >>dh-file
"password" >>password
[ ] with-secure-context
] unit-test

View File

@ -10,7 +10,7 @@ IN: io.windows.files
: open-file ( path access-mode create-mode flags -- handle )
[
>r >r share-mode security-attributes-inherit r> r>
>r >r share-mode default-security-attributes r> r>
CreateFile-flags f CreateFile opened-file
] with-destructors ;

View File

@ -46,7 +46,7 @@ IN: io.windows.nt.launcher
path normalize-path
access-mode
share-mode
security-attributes-inherit
default-security-attributes
create-mode
FILE_ATTRIBUTE_NORMAL ! flags and attributes
f ! template file
@ -58,11 +58,8 @@ IN: io.windows.nt.launcher
redirect-file
dup 0 FILE_END set-file-pointer ;
: set-inherit ( handle ? -- )
>r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ;
: redirect-handle ( handle access-mode create-mode -- handle )
2drop handle>> duplicate-handle dup t set-inherit ;
2drop handle>> duplicate-handle ;
: redirect-stream ( stream access-mode create-mode -- handle )
>r >r underlying-handle handle>> r> r> redirect-handle ;
@ -75,7 +72,8 @@ IN: io.windows.nt.launcher
{ [ pick appender? ] [ redirect-append ] }
{ [ pick win32-file? ] [ redirect-handle ] }
[ redirect-stream ]
} cond ;
} cond
dup [ dup t set-inherit ] when ;
: redirect-stdout ( process args -- handle )
drop

View File

@ -12,6 +12,7 @@ USE: io.windows.nt.sockets
USE: io.windows.mmap
USE: io.windows.files
USE: io.backend
USE: openssl
USE: system
winnt set-io-backend

View File

@ -16,13 +16,13 @@ IN: io.windows.nt.pipes
4096
4096
0
security-attributes-inherit
default-security-attributes
CreateNamedPipe opened-file ;
: open-other-end ( name -- handle )
GENERIC_WRITE
{ FILE_SHARE_READ FILE_SHARE_WRITE } flags
security-attributes-inherit
default-security-attributes
OPEN_EXISTING
FILE_FLAG_OVERLAPPED
f

View File

@ -7,8 +7,7 @@ HOOK: WSASocket-flags io-backend ( -- DWORD )
TUPLE: win32-socket < win32-file ;
: <win32-socket> ( handle -- win32-socket )
win32-socket new
swap >>handle ;
win32-socket new-win32-handle ;
M: win32-socket dispose ( stream -- )
handle>> closesocket drop ;

View File

@ -8,10 +8,13 @@ windows.shell32 windows.types windows.winsock splitting
continuations math.bitfields system accessors ;
IN: io.windows
: set-inherit ( handle ? -- )
>r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ;
TUPLE: win32-handle handle disposed ;
: new-win32-handle ( handle class -- win32-handle )
new swap >>handle ;
new swap [ >>handle ] [ f set-inherit ] bi ;
: <win32-handle> ( handle -- win32-handle )
win32-handle new-win32-handle ;