@@ -27,9 +27,9 @@ export class FastTransformer
27
27
# Starts the underlying PHP process and begins accepting connections.
28
28
listen : -> if @_process ? then Promise .resolve @_port else
29
29
@_port = await @ _getPort ()
30
- args = [" -S" , " 127.0.0.1:#{ @_port } " , " -t" , join (import .meta .dirname , " ../www" )]
31
30
new Promise (fulfill , reject ) =>
32
- spawn @_executable , args, stdio : [" ignore" , " pipe" , " ignore" ]
31
+ args = [" -S" , " 127.0.0.1:#{ @_port } " , " -t" , join (import .meta .dirname , " ../www" )]
32
+ @_process = spawn @_executable , args, stdio : [" ignore" , " pipe" , " ignore" ]
33
33
.on " error" , reject
34
34
.on " spawn" , => setTimeout (=> fulfill @_port ), 1000
35
35
@@ -45,8 +45,7 @@ export class FastTransformer
45
45
46
46
# Gets an ephemeral TCP port chosen by the system.
47
47
_getPort : -> new Promise (fulfill , reject ) ->
48
- socket = createServer ().on " error" , reject
49
- socket .unref ()
50
- socket .listen host : " 127.0.0.1" , port : 0 , ->
51
- {port } = socket .address ()
52
- socket .close -> fulfill port
48
+ server = createServer ().unref ().on " error" , reject
49
+ server .listen host : " 127.0.0.1" , port : 0 , ->
50
+ {port } = server .address ()
51
+ server .close -> fulfill port
0 commit comments