Handle inheritance fixes for tools.deploy.test.5
parent
aed0909c55
commit
366d7009b8
|
@ -2,3 +2,11 @@ IN: io.sockets.secure.tests
|
||||||
USING: accessors kernel io.sockets io.sockets.secure tools.test ;
|
USING: accessors kernel io.sockets io.sockets.secure tools.test ;
|
||||||
|
|
||||||
[ "hello" 24 ] [ "hello" 24 <inet> <secure> [ host>> ] [ port>> ] bi ] unit-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
|
||||||
|
|
|
@ -10,7 +10,7 @@ IN: io.windows.files
|
||||||
|
|
||||||
: open-file ( path access-mode create-mode flags -- handle )
|
: 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
|
CreateFile-flags f CreateFile opened-file
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ IN: io.windows.nt.launcher
|
||||||
path normalize-path
|
path normalize-path
|
||||||
access-mode
|
access-mode
|
||||||
share-mode
|
share-mode
|
||||||
security-attributes-inherit
|
default-security-attributes
|
||||||
create-mode
|
create-mode
|
||||||
FILE_ATTRIBUTE_NORMAL ! flags and attributes
|
FILE_ATTRIBUTE_NORMAL ! flags and attributes
|
||||||
f ! template file
|
f ! template file
|
||||||
|
@ -58,11 +58,8 @@ IN: io.windows.nt.launcher
|
||||||
redirect-file
|
redirect-file
|
||||||
dup 0 FILE_END set-file-pointer ;
|
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 )
|
: 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 )
|
: redirect-stream ( stream access-mode create-mode -- handle )
|
||||||
>r >r underlying-handle handle>> r> r> redirect-handle ;
|
>r >r underlying-handle handle>> r> r> redirect-handle ;
|
||||||
|
@ -75,7 +72,8 @@ IN: io.windows.nt.launcher
|
||||||
{ [ pick appender? ] [ redirect-append ] }
|
{ [ pick appender? ] [ redirect-append ] }
|
||||||
{ [ pick win32-file? ] [ redirect-handle ] }
|
{ [ pick win32-file? ] [ redirect-handle ] }
|
||||||
[ redirect-stream ]
|
[ redirect-stream ]
|
||||||
} cond ;
|
} cond
|
||||||
|
dup [ dup t set-inherit ] when ;
|
||||||
|
|
||||||
: redirect-stdout ( process args -- handle )
|
: redirect-stdout ( process args -- handle )
|
||||||
drop
|
drop
|
||||||
|
|
|
@ -12,6 +12,7 @@ USE: io.windows.nt.sockets
|
||||||
USE: io.windows.mmap
|
USE: io.windows.mmap
|
||||||
USE: io.windows.files
|
USE: io.windows.files
|
||||||
USE: io.backend
|
USE: io.backend
|
||||||
|
USE: openssl
|
||||||
USE: system
|
USE: system
|
||||||
|
|
||||||
winnt set-io-backend
|
winnt set-io-backend
|
||||||
|
|
|
@ -16,13 +16,13 @@ IN: io.windows.nt.pipes
|
||||||
4096
|
4096
|
||||||
4096
|
4096
|
||||||
0
|
0
|
||||||
security-attributes-inherit
|
default-security-attributes
|
||||||
CreateNamedPipe opened-file ;
|
CreateNamedPipe opened-file ;
|
||||||
|
|
||||||
: open-other-end ( name -- handle )
|
: open-other-end ( name -- handle )
|
||||||
GENERIC_WRITE
|
GENERIC_WRITE
|
||||||
{ FILE_SHARE_READ FILE_SHARE_WRITE } flags
|
{ FILE_SHARE_READ FILE_SHARE_WRITE } flags
|
||||||
security-attributes-inherit
|
default-security-attributes
|
||||||
OPEN_EXISTING
|
OPEN_EXISTING
|
||||||
FILE_FLAG_OVERLAPPED
|
FILE_FLAG_OVERLAPPED
|
||||||
f
|
f
|
||||||
|
|
|
@ -7,8 +7,7 @@ HOOK: WSASocket-flags io-backend ( -- DWORD )
|
||||||
TUPLE: win32-socket < win32-file ;
|
TUPLE: win32-socket < win32-file ;
|
||||||
|
|
||||||
: <win32-socket> ( handle -- win32-socket )
|
: <win32-socket> ( handle -- win32-socket )
|
||||||
win32-socket new
|
win32-socket new-win32-handle ;
|
||||||
swap >>handle ;
|
|
||||||
|
|
||||||
M: win32-socket dispose ( stream -- )
|
M: win32-socket dispose ( stream -- )
|
||||||
handle>> closesocket drop ;
|
handle>> closesocket drop ;
|
||||||
|
|
|
@ -8,10 +8,13 @@ windows.shell32 windows.types windows.winsock splitting
|
||||||
continuations math.bitfields system accessors ;
|
continuations math.bitfields system accessors ;
|
||||||
IN: io.windows
|
IN: io.windows
|
||||||
|
|
||||||
|
: set-inherit ( handle ? -- )
|
||||||
|
>r HANDLE_FLAG_INHERIT r> >BOOLEAN SetHandleInformation win32-error=0/f ;
|
||||||
|
|
||||||
TUPLE: win32-handle handle disposed ;
|
TUPLE: win32-handle handle disposed ;
|
||||||
|
|
||||||
: new-win32-handle ( handle class -- win32-handle )
|
: new-win32-handle ( handle class -- win32-handle )
|
||||||
new swap >>handle ;
|
new swap [ >>handle ] [ f set-inherit ] bi ;
|
||||||
|
|
||||||
: <win32-handle> ( handle -- win32-handle )
|
: <win32-handle> ( handle -- win32-handle )
|
||||||
win32-handle new-win32-handle ;
|
win32-handle new-win32-handle ;
|
||||||
|
|
Loading…
Reference in New Issue