Skip to content

Commit

Permalink
re-adding message handling to fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Courey committed Jun 11, 2024
1 parent b40c77f commit bd153a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
*.js
!esbuild.js
*.tgz
11 changes: 11 additions & 0 deletions launchSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

import Dockerode from 'dockerode'

type Message = {
action: string
}

const [, , argv] = process.argv
const { dataDir, logsDir, engine, port, options } = JSON.parse(argv)

Expand Down Expand Up @@ -51,6 +55,13 @@ async function launch() {
waiting()
}

process.once('message', async (message: Message) => {
if (message.action === 'kill') {
await dockerContainer.kill()
process.exit(0)
}
})

launch()

const signals = ['SIGTERM', 'SIGINT']
Expand Down

0 comments on commit bd153a2

Please sign in to comment.