Skip to content

Commit

Permalink
feat: proper exit signal
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Sep 6, 2024
1 parent 4e7b720 commit d161ad0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@filen/virtual-drive",
"version": "0.1.12",
"version": "0.1.13",
"description": "Filen Virtual Drive",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ export class VirtualDrive {
this.rcloneProcess.on("error", err => {
rcloneSpawned = false

this.rcloneProcess = null

clearInterval(checkInterval)
clearTimeout(checkTimeout)

Expand Down Expand Up @@ -728,7 +730,10 @@ export class VirtualDrive {
}
}

this.rcloneProcess?.kill("SIGKILL")
await new Promise<void>(resolve => {
this.rcloneProcess?.on("exit", resolve)
this.rcloneProcess?.kill("SIGTERM")
})

if (this.rcloneProcess.pid) {
await killProcessByPid(this.rcloneProcess.pid).catch(() => {})
Expand Down

0 comments on commit d161ad0

Please sign in to comment.