fix(tauri): usa tauri.cmd real via node_modules/.bin e cwd correto
This commit is contained in:
parent
bb6c3c16a1
commit
ff68348442
1 changed files with 5 additions and 1 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue