Skip to content

Commit bd0eed3

Browse files
committed
mitogen: Allow line comments in first stage, strip them.
1 parent 2305446 commit bd0eed3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mitogen/parent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,9 @@ def get_python_argv(self):
14661466
return [self.options.python_path]
14671467

14681468
def get_boot_command(self):
1469-
source = inspect.getsource(self._first_stage)
1470-
source = textwrap.dedent('\n'.join(source.strip().split('\n')[2:]))
1469+
lines = inspect.getsourcelines(self._first_stage)[0][2:]
1470+
# Remove line comments, leading indentation, trailing newline
1471+
source = textwrap.dedent(''.join(s for s in lines if '#' not in s))[:-1]
14711472
source = source.replace(' ', ' ')
14721473
source = source.replace('CONTEXT_NAME', self.options.remote_name)
14731474
preamble_compressed = self.get_preamble()

0 commit comments

Comments
 (0)