File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,11 @@ void PipeWrap::Initialize(Local<Object> target,
53
53
env->SetProtoMethod (t, " ref" , HandleWrap::Ref);
54
54
env->SetProtoMethod (t, " hasRef" , HandleWrap::HasRef);
55
55
56
+ #ifdef _WIN32
56
57
StreamWrap::AddMethods (env, t);
58
+ #else
59
+ StreamWrap::AddMethods (env, t, StreamBase::kFlagHasWritev );
60
+ #endif
57
61
58
62
env->SetProtoMethod (t, " bind" , Bind);
59
63
env->SetProtoMethod (t, " listen" , Listen);
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ const common = require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
5
+ const net = require ( 'net' ) ;
6
+
7
+ if ( common . isWindows ) {
8
+ common . skip ( 'Unix-specific test' ) ;
9
+ return ;
10
+ }
11
+
12
+ common . refreshTmpDir ( ) ;
13
+
14
+ const server = net . createServer ( ( connection ) => {
15
+ connection . on ( 'error' , ( err ) => {
16
+ throw err ;
17
+ } ) ;
18
+
19
+ const writev = connection . _writev . bind ( connection ) ;
20
+ connection . _writev = common . mustCall ( writev ) ;
21
+
22
+ connection . cork ( ) ;
23
+ connection . write ( 'pi' ) ;
24
+ connection . write ( 'ng' ) ;
25
+ connection . end ( ) ;
26
+ } ) ;
27
+
28
+ server . on ( 'error' , ( err ) => {
29
+ throw err ;
30
+ } ) ;
31
+
32
+ server . listen ( common . PIPE , ( ) => {
33
+ const client = net . connect ( common . PIPE ) ;
34
+
35
+ client . on ( 'error' , ( err ) => {
36
+ throw err ;
37
+ } ) ;
38
+
39
+ client . on ( 'data' , common . mustCall ( ( data ) => {
40
+ assert . strictEqual ( data . toString ( ) , 'ping' ) ;
41
+ } ) ) ;
42
+
43
+ client . on ( 'end' , ( ) => {
44
+ server . close ( ) ;
45
+ } ) ;
46
+ } ) ;
You can’t perform that action at this time.
0 commit comments