|
@@ -98,8 +98,6 @@ ipcMain.handle('dialog:open', async (event, options = {}) => {
|
|
|
|
|
|
|
|
|
ipcMain.on('docker-import', (event, sudoPassword, filePath, tag) => {
|
|
|
-
|
|
|
-
|
|
|
const command = 'echo "' + sudoPassword + '" | sudo -S docker import ' + filePath + ' pji_nav:' + tag
|
|
|
console.log('导入算法镜像文件:', command);
|
|
|
exec(command, (error, stdout, stderr) => {
|
|
@@ -111,3 +109,34 @@ ipcMain.on('docker-import', (event, sudoPassword, filePath, tag) => {
|
|
|
console.error(`stderr: ${stderr}`);
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ipcMain.on('generate-world', (event, rosbag_path) => {
|
|
|
+ // const command = 'sh /home/cicv/work/pji_desktop/run_map2gazabo.sh'
|
|
|
+ //
|
|
|
+ // exec(command, (error, stdout, stderr) => {
|
|
|
+ // if (error) {
|
|
|
+ // console.error(`exec error: ${error}`);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // console.log(`stdout: ${stdout}`);
|
|
|
+ // console.error(`stderr: ${stderr}`);
|
|
|
+ // });
|
|
|
+
|
|
|
+ // 在 Electron 应用启动后执行本地脚本
|
|
|
+ const serviceScript = 'sh /home/cicv/work/pji_desktop/run_map2gazabo.sh';
|
|
|
+
|
|
|
+ // 使用 spawn 启动脚本
|
|
|
+ const serviceProcess = spawn(serviceScript, [], { detached: true });
|
|
|
+
|
|
|
+ // 设置为后台进程
|
|
|
+ serviceProcess.unref();
|
|
|
+
|
|
|
+ // 监听输出
|
|
|
+ serviceProcess.stdout.on('data', (data) => {
|
|
|
+ console.log(`Service output: ${data}`);
|
|
|
+ });
|
|
|
+
|
|
|
+ serviceProcess.stderr.on('data', (data) => {
|
|
|
+ console.error(`Service error: ${data}`);
|
|
|
+ });
|
|
|
+});
|