fix(tauri.js) kill beforeDevProcess on shutdown
@@ -14,7 +14,7 @@ import { tauriDir, appDir } from './helpers/app-paths'
import logger from './helpers/logger'
import onShutdown from './helpers/on-shutdown'
import { spawn, spawnSync } from './helpers/spawn'
-import { exec } from 'child_process'
+import { exec, ChildProcess } from 'child_process'
import { TauriConfig } from './types/config'
import { CargoManifest } from './types/cargo'
import getTauriConfig from './helpers/tauri-config'
@@ -32,7 +32,7 @@ class Runner {
tauriWatcher?: FSWatcher
devPath?: string
killPromise?: Function
- ranBeforeDevCommand?: boolean
+ beforeDevProcess?: ChildProcess
devServer?: net.Server
constructor() {
@@ -54,8 +54,7 @@ class Runner {
}
}
- if (!this.ranBeforeDevCommand && cfg.build.beforeDevCommand) {
- this.ranBeforeDevCommand = true // prevent calling it twice on recursive call on our watcher
+ if (!this.beforeDevProcess && cfg.build.beforeDevCommand) {
log('Running `' + cfg.build.beforeDevCommand + '`')
const ls = exec(cfg.build.beforeDevCommand, {
cwd: appDir,
@@ -68,6 +67,7 @@ class Runner {
ls.stderr?.pipe(process.stderr)
ls.stdout?.pipe(process.stdout)
+ this.beforeDevProcess = ls
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
