1

I want to use Node or Rust in Electron or Tauri to execute some command commands,like

$ rosbag info xxxx

and in Node I call rosbag with spawn function and the result is right, but when I build app, I get error

const command = spawn('rosbag', ['info', 'xxxxx']);

command .stdout.on('data', data => {
  console.log('data',data.toString())
})

I try the rosbag path like:

const command = spawn('/opt/ros/melodic/bin/rosbag', ['info', 'xxxxx']);

command .stdout.on('data', data => {
  console.log('data',data.toString())
})

In the Rust:

fn get_bag_info(file_path: &str) -> String {    
    let output = Command::new("rosbag")
                   .arg("info")
                   .arg(file_path)
                   .output()
                   .expect("error while running tauri application");   
    return String::from_utf8(output.stdout).unwrap();
}

In the electron run :

 pnpm start

enter image description here

When I make after, get error

pnpm make

enter image description here

In the tauri --- dev

enter image description here

In the tauri --- build

enter image description here

beanBag
  • 11
  • 3

0 Answers0