Pass args to lldb_batchmode.py via environment variables

This commit is contained in:
Zalathar 2025-11-08 17:30:10 +11:00
parent 5038a0a456
commit 6edb4f4a39
2 changed files with 12 additions and 8 deletions

View file

@ -176,18 +176,22 @@ def start_watchdog():
watchdog_thread.start()
def get_env_arg(name):
value = os.environ.get(name)
if value is None:
print("must set %s" % name)
sys.exit(1)
return value
####################################################################################################
# ~main
####################################################################################################
def main():
if len(sys.argv) != 3:
print("usage: python lldb_batchmode.py target-path script-path")
sys.exit(1)
target_path = sys.argv[1]
script_path = sys.argv[2]
target_path = get_env_arg("LLDB_BATCHMODE_TARGET_PATH")
script_path = get_env_arg("LLDB_BATCHMODE_SCRIPT_PATH")
print("LLDB batch-mode script")
print("----------------------")

View file

@ -458,8 +458,8 @@ impl TestCx<'_> {
self.run_command_to_procres(
Command::new(&self.config.python)
.arg(&lldb_script_path)
.arg(test_executable)
.arg(debugger_script)
.env("LLDB_BATCHMODE_TARGET_PATH", test_executable)
.env("LLDB_BATCHMODE_SCRIPT_PATH", debugger_script)
.env("PYTHONUNBUFFERED", "1") // Help debugging #78665
.env("PYTHONPATH", pythonpath),
)