Есть простейший скриптик, вот он:
#!/usr/bin/env python3
import sys
import subprocess
list_of_files = []
list_of_files += sys.argv[1:]
if not sys.stdin.isatty():
list_of_files += sys.stdin.read().splitlines()
phpcs = ['./vendor/bin/phpcs', '-d', 'memory_limit=-1', '--encoding=utf-8', '-n', '-p']
phplinter = ['php', '-l', '-d', 'display_errors=0']
if len(list_of_files) == 0:
print('No files to check')
exit(0)
else:
print('Changed files:')
for item in list_of_files:
print(item)
print("Running phpcs")
subprocess.run(phpcs + list_of_files, check=True)
print('Running PHP Linter')
for item in list_of_files:
subprocess.run(phplinter + [item], check=True)
Я использую этот скрипт в качестве entrypoint в докере. Когда я скармливаю ему список файлов через stdin локально, то всё работает. А когда делаю тоже самое через докер, то всё падает, потому что какого-то чёрта лист, который должен был получиться в list_of_files, получается сплошной строкой. Что я делаю не так и как сделать правильно?