Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target里on_load打印消息,会导致run或debug无法运行 #261

Open
Wzshun opened this issue Mar 28, 2024 · 1 comment
Open

Target里on_load打印消息,会导致run或debug无法运行 #261

Wzshun opened this issue Mar 28, 2024 · 1 comment
Labels

Comments

@Wzshun
Copy link

Wzshun commented Mar 28, 2024

Xmake 版本

2.8.8

操作系统版本和架构

windows11

描述问题

add_rules("mode.debug", "mode.release")

target("basenameIssue")
    set_kind("binary")
    add_files("src/*.cpp")
    on_load(function (target) 
        local venderInfo = {appName = "hello"}
        print("venderInfo:", venderInfo)

        --target:set("basename", venderInfo.appName)
    end)

编译通过,但是点击vscode状态栏的run或者debug,无法运行。

此外终端里,调用xmake run,运行正常。

期待的结果

vscode状态栏run或debug,能正常工作,在on load打印消息时。

工程配置

附加信息和错误日志

正在执行任务: xmake run 'venderInfo: { 
  appName = "hello" 
}

basenameIssue' 

venderInfo: { 
  appName = "hello" 
}

error: venderInfo: { 
 appName = hello 
}

basenameIssue is not a valid target name for this project

 *  终端进程“C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command xmake run 'venderInfo: { 
  appName = "hello" 
}

basenameIssue'”已终止,退出代码: 1。 
 *  终端将被任务重用,按任意键关闭。 
@Wzshun Wzshun added the bug label Mar 28, 2024
@waruqi
Copy link
Member

waruqi commented Mar 29, 2024

不要加 print ,会干扰插件对 target file 的获取。。

如果你想过滤这部分 print 的干扰,就自己提 pr 过来改进下,我最近也没空细改这块。

https://github.com/xmake-io/xmake-vscode/blob/master/assets/targetpath.lua

let getTargetPathScript = path.join(__dirname, `../../assets/targetpath.lua`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants