LiteLDev / LegacyScriptEngine

A plugin engine for running LLSE plugins on LeviLamina
https://lse.liteldev.com/
GNU General Public License v3.0
43 stars 8 forks source link

[Bug]: 当加载`legacy-script-engine-python`等插件后无法处理重定向输入流的输入 #156

Closed Zaitonn closed 1 month ago

Zaitonn commented 1 month ago

Describe the bug

当使用面板软件(SereinEQ面板等)启动LeviLamina时无法正常输入,但输出流均正常

面板原理:将服务器作为子进程启动,通过处理服务器输出和提供各种快捷功能方便服主使用/管理/控制

目前(应该)已排除面板内部问题,且使用不具有处理服务器输入和输出的程序(仅重定向输入和输出)测试仍能稳定复现(见下To Reproduce)

To Reproduce

  1. 写一个壳子重定向bds的输出流

    // C#
    using System.Diagnostics;
    
    var file = Environment.GetCommandLineArgs()[1];
    
    var process = Process.Start(new ProcessStartInfo(file)
    {
        UseShellExecute = false,
        CreateNoWindow = true,
        RedirectStandardOutput = true,
        RedirectStandardError = true,
        RedirectStandardInput = true,
    })!;
    
    process.BeginOutputReadLine();
    process.BeginErrorReadLine();
    
    process.OutputDataReceived += OnOutputDataReceived;
    process.ErrorDataReceived += OnOutputDataReceived;
    
    do
    {
        process.StandardInput.WriteLine(Console.ReadLine());
    }
    while (!process.HasExited);
    
    static void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
    {
        Console.WriteLine(e.Data);
    }

    编译后文件(需要net8.0运行库) win-x64.zip

  2. 将文件放到bds同目录下
  3. bedrock_server_mod.exe拖拽到编译后的可执行文件上使用其打开
  4. 待服务器启动后随便输点什么后回车 image 输入stop仍未关服,应该是还未处理输入内容
  5. 强制结束进程后删除plugins/legacy-script-engine-python后使用第二步运行服务器 image 就正常了

插件列表

Expected behavior

正常处理并响应

Screenshots

见上

Platform

Windows 10

Version

1.21.3.01(ProtocolVersion 686) with LeviLamina-0.13.4+740e75ff4

Additional context

EQ面板作者 @XY0797 曾在5.30在其面板的交流群提及此事,当时给出的临时解决方案为删除plugins下的legacy-script-engine-python和legacy-script-engine-nodejs

今天(8.1)测试发现只需删除legacy-script-engine-python即可恢复正常

三个多月了影响版本范围应该挺大的 怎么没人反馈(?)

可能和这俩插件引擎有点关系? 不是很懂请多指教:(

ShrBox commented 1 month ago

Python的问题,无解 Python还会导致包破损,总之Python和BDS存在兼容性问题