import { platform } from "@tauri-apps/plugin-os" import { Command } from "@tauri-apps/plugin-shell" export const runCommand = async ( taskId: string, name: string, password: string ) => { const platformName = platform() const cmdStr = /^win/i.test(platformName) ? "labeltool_windows" : "labeltool_linux" let dStr = process.env.NEXT_PUBLIC_URL || "" const command = Command.create(cmdStr, [ "--t", taskId, "--u", name, "--p", password, "--d", dStr, ]) // command.on("close", (data) => { // console.log( // `command finished with code ${data.code} and signal ${data.signal}` // ); // }); // command.on("error", (error) => console.error(`command error: "${error}"`)); // command.stdout.on("data", (line) => // console.log(`command stdout: "${line}"`) // ); // command.stderr.on("data", (line) => // console.log(`command stderr: "${line}"`) // ); await command.execute() // console.log("pid:", child); }