Skip to content
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

Post build hook command fails on Windows with spaces in the path #316

Open
benlye opened this issue Mar 18, 2019 · 1 comment
Open

Post build hook command fails on Windows with spaces in the path #316

benlye opened this issue Mar 18, 2019 · 1 comment
Labels
os: windows Specific to Windows operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@benlye
Copy link

benlye commented Mar 18, 2019

I have a board package which runs a postobjcopy hook command:
recipe.hooks.objcopy.postobjcopy.01.pattern.windows="{runtime.platform.path}/tools/win/do_version.bat" "{build.path}" "{build.project_name}" "{build.source.path}" {build.board}

If the Windows username includes a space, and the path to the sketch folder includes a space, I get an error when the hook command attempts to run.

For example:

Linking everything together...
[snip linker commands]
"C:\\Users\\Test User\\AppData\\Local\\Arduino15\\packages\\multi4in1\\hardware\\STM32F1\\1.1.1/tools/win/do_version.bat" "C:\\Users\\Test User\\AppData\\Local\\Temp\\arduino_build_753864" Multiprotocol.ino "C:\\Users\\Test User\\GitHub\\DIY-Multiprotocol-TX-Module\\Multiprotocol" MULTI_STM32_WITH_BOOT=110
'C:\Users\Test' is not recognized as an internal or external command,

operable program or batch file.

If I move the sketch to a folder without spaces, or if the build is run from a user account without spaces the hook command runs fine.

To summarize, when running recipe hook commands, spaces are tolerated either in the sketch path or in the platform path, but not both.

I ran arduino-builder with --debug-level=10 and put the output here:
https://gist.github.com/benlye/93733a920caff6ffec6bad5a4605476d

In that example the user profile folder is C:\Users\Test User\ and the sketch path is C:\Temp\foo bar\Multiprotocol.

Maybe the command line escaping is misfiring somewhere?

There is a very old issue logged against the Arduino IDE, but it seems like the problem is really in arduino-builder.

@benlye
Copy link
Author

benlye commented Mar 18, 2019

Update - seems like a long-standing issue in Go when calling Windows' cmd.exe (i.e. .bat or .cmd files):
golang/go#17149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows Specific to Windows operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants