Skip to content

Add support for command length limitation on Windows in CheckToolBase #5100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions platformio/check/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from platformio import fs, proc
from platformio.check.defect import DefectItem
from platformio.compat import IS_WINDOWS
from platformio.package.manager.core import get_core_package_dir
from platformio.package.meta import PackageSpec
from platformio.project.helpers import load_build_metadata
Expand Down Expand Up @@ -189,6 +190,9 @@ def is_check_successful(cmd_result):
return cmd_result["returncode"] == 0

def execute_check_cmd(self, cmd):
if IS_WINDOWS and len(" ".join(cmd)) > 8191:
cmd = self._create_response_file(cmd)

result = proc.exec_command(
cmd,
stdout=proc.LineBufferedAsyncPipe(self.on_tool_output),
Expand All @@ -207,6 +211,10 @@ def execute_check_cmd(self, cmd):

return result

def _create_response_file(self, cmd):
response_file = self._create_tmp_file("\n".join(cmd[1:]))
return [cmd[0], "@%s" % response_file]

@staticmethod
def get_project_target_files(project_dir, src_filters):
c_extension = (".c",)
Expand Down