Skip to content

Commit 93708de

Browse files
committed
Added required protections/arguments for IronPython
IronPython must be ran with its Frames feature enabled for Cohorte to run.
1 parent 8ebffb5 commit 93708de

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

bin/cohorte-start-node.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
22

33
REM Use "python" if no interpreter is specified
4-
if "%PYTHON_INTERPRETER%"=="" set PYTHON_INTERPRETER="python"
5-
%PYTHON_INTERPRETER% %COHORTE_HOME%\bin\scripts\cohorte-start-node.py -c %*
4+
if "%PYTHON_INTERPRETER%"=="" set PYTHON_INTERPRETER=python
5+
"%PYTHON_INTERPRETER%" "%COHORTE_HOME%\bin\scripts\cohorte-start-node.py" -c %*

bin/scripts/cohorte-start-node.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ def main(args=None):
253253
if value is not None]
254254
os.environ['PYTHONPATH'] = os.pathsep.join(added_paths)
255255

256+
# Special case: IronPython path uses a different environment variable
257+
if sys.platform == 'cli':
258+
os.environ['IRONPYTHONPATH'] = os.environ['PYTHONPATH']
259+
256260
# Change our path
257261
sys.path = added_paths + sys.path
258262

@@ -564,12 +568,22 @@ def main(args=None):
564568
# starting cohorte isolate
565569
result_code = 0
566570
#python_interpreter = prepare_interpreter()
571+
572+
# Interpreter arguments
573+
interpreter_args = ['-m', 'cohorte.boot.boot']
574+
if sys.platform == 'cli':
575+
# Enable frames support in IronPython
576+
interpreter_args.insert(0, '-X:Frames')
577+
567578
try:
568579
p = subprocess.Popen(
569-
[PYTHON_INTERPRETER, "-m", "cohorte.boot.boot"] + boot_args,
580+
[PYTHON_INTERPRETER] + interpreter_args + boot_args,
570581
stdin=None, stdout=None, stderr=None, shell=False)
571582
except Exception as ex:
572583
print("Error starting node:", ex)
584+
import logging
585+
logging.exception("Error starting node: %s -- interpreter = %s",
586+
ex, PYTHON_INTERPRETER)
573587
result_code = 1
574588
else:
575589
try:

0 commit comments

Comments
 (0)