From 070a7d4b4b18db72963b4f42e2a039a0eb96124b Mon Sep 17 00:00:00 2001 From: DenkChan <33553308+DenkChan@users.noreply.github.com> Date: Sat, 27 Apr 2024 14:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=87=AA=E5=8A=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/backend/mi2/mi2.ts | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 93dae1a..ac3294a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "si-debug", "displayName": "SuperIDE Debug", + "publisher": "mengning", "description": "GDB, LLDB & Mago-MI Debugger support for SuperIDE", "keywords": [ "gdb", @@ -9,7 +10,7 @@ "native", "debug" ], - "license": "public domain", + "license": "Apache-2.0", "version": "0.27.1", "author": { "name": "PlatformIO.Org" diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 63a7e9e..30bff7a 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -7,6 +7,7 @@ import * as net from "net"; import * as fs from "fs"; import * as path from "path"; import { Client } from "ssh2"; +import * as os from "os"; export function escape(str: string) { return str.replace(/\\/g, "\\\\").replace(/"/g, "\\\""); @@ -54,15 +55,12 @@ export class MI2 extends EventEmitter implements IBackend { return new Promise((resolve, reject) => { this.isSSH = false; const args = this.preargs.concat(this.extraargs || []); - const pythonInterpreter = '/home/denk/.superide/penv/bin/python3'; // 或者 'python',取决于你的系统和配置 - //const pythonInterpreter = 'super-ide'; // 或者 'python',取决于你的系统和配置 - // const pythonScript = ['/home/denk/.superide/penv/lib/python3.10/site-packages/superide/__main__.py', - // 'debug', '-d', '/home/denk/PlatformIO/Projects/hello', - // '--interface=gdb', '--interpreter=mi2', '-q']; - const pythonScript = ['-m','superide','debug', '-d', '/home/denk/PlatformIO/Projects/hello', + // projects_name需要从si-core或si-ide中获得 + const pythonInterpreter = '/home/'+os.userInfo().username+'/.superide/penv/bin/python3'; + const pythonScript = ['-m','superide','debug', '-d', '/home/'+os.userInfo().username+'/superide/Projects/project_name', '--interface=gdb', '--interpreter=mi2', '-q']; //this.process = ChildProcess.spawn(pythonInterpreter, pythonScript, spawnOptions1); - this.process = ChildProcess.spawn(pythonInterpreter, pythonScript, { cwd: '/home/denk/PlatformIO/Projects/hello', env: this.procEnv }); + this.process = ChildProcess.spawn(pythonInterpreter, pythonScript, { cwd: '/home/'+os.userInfo().username+'/superide/Projects/project_name', env: this.procEnv }); //this.process = ChildProcess.spawn(this.application, args, { cwd: cwd, env: this.procEnv }); this.process.stdout.on("data", this.stdout.bind(this)); this.process.stderr.on("data", this.stderr.bind(this)); -- Gitee