fix(tauri): usa tauri.cmd real via node_modules/.bin e cwd correto

This commit is contained in:
Esdras Renan 2025-11-25 13:54:05 -03:00
parent bb6c3c16a1
commit ff68348442

View file

@ -1,9 +1,11 @@
import { spawn } from "node:child_process"
import { fileURLToPath } from "node:url"
import { dirname, resolve } from "node:path"
import { existsSync } from "node:fs"
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const appRoot = resolve(__dirname, "..")
const pathKey = process.platform === "win32" ? "Path" : "PATH"
const currentPath = process.env[pathKey] ?? process.env[pathKey.toUpperCase()] ?? ""
@ -23,10 +25,12 @@ if (!process.env.TAURI_BUNDLE_TARGETS) {
}
}
const executable = process.platform === "win32" ? resolve(stubDir, "tauri.cmd") : "tauri"
const winTauriPath = resolve(appRoot, "node_modules", ".bin", "tauri.cmd")
const executable = process.platform === "win32" && existsSync(winTauriPath) ? winTauriPath : "tauri"
const child = spawn(executable, process.argv.slice(2), {
stdio: "inherit",
shell: false,
cwd: appRoot,
})
child.on("exit", (code, signal) => {