Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Dumb implementation for support --port and --host for hooks server #712

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/hooks-worker-client.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ class HooksWorkerClient
callback()

spawnHandler: (callback) ->
pathGlobs = [].concat @runner.hooks?.configuration?.options?.hookfiles
args = [].concat ["--port=#{@handlerPort}","--host=#{@handlerHost}"], @runner.hooks?.configuration?.options?.hookfiles

logger.info("Spawning `#{@language}` hooks handler process.")
@handler = crossSpawn.spawn @handlerCommand, pathGlobs
logger.info("Spawning `#{@language}` hooks handler process with command `#{@handlerCommand} #{args.join ","}`.")
@handler = crossSpawn.spawn @handlerCommand, args

@handler.stdout.on 'data', (data) ->
logger.info("Hooks handler stdout:", data.toString())
Expand Down
12 changes: 6 additions & 6 deletions test/unit/hooks-worker-client-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'somefile.rb'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'somefile.rb'
done()

describe 'when --language ruby option is given and the worker is not installed', ->
Expand Down Expand Up @@ -247,7 +247,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'somefile.py'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'somefile.py'
done()

describe 'when --language python option is given and the worker is not installed', ->
Expand Down Expand Up @@ -310,7 +310,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'somefile.py'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'somefile.py'
done()

describe 'when --language go option is given and the worker is not installed', ->
Expand Down Expand Up @@ -373,7 +373,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'gobinary'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'gobinary'
done()

describe 'when --language php option is given and the worker is not installed', ->
Expand Down Expand Up @@ -436,7 +436,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'somefile.py'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'somefile.py'
done()

describe 'when --language perl option is given and the worker is not installed', ->
Expand Down Expand Up @@ -499,7 +499,7 @@ describe 'Hooks worker client', ->

hooksWorkerClient.stop (err) ->
assert.isUndefined err
assert.equal crossSpawnStub.spawn.getCall(0).args[1][0], 'someotherfile'
assert.equal crossSpawnStub.spawn.getCall(0).args[1][2], 'someotherfile'
done()

describe "after loading", ->
Expand Down