Closed xobs closed 1 year ago
Hopefully one of these days I'll get around to testing this on a Windows host machine. Have you made any more progress since your initial report?
I have discovered a workaround to this. I have a patch I've made to get mkespfsimage.py
working.
I was getting ready to make a PR, but then I discovered that it no longer exists. I believe a similar patch would be:
diff --git a/tools/preprocess.py b/tools/preprocess.py
index 8358e0d..9dfb3ef 100755
--- a/tools/preprocess.py
+++ b/tools/preprocess.py
@@ -251,6 +251,10 @@ def preprocess(path, preprocessors):
command = config['preprocessors'][preprocessor]['command']
if command[0].startswith('tools/'):
command[0] = os.path.join(script_dir, command[0][6:])
+ # These are implemented as `.cmd` files on Windows, which explicitly
+ # requires them to be run under `cmd /c`
+ if os.name == 'nt':
+ command = ["cmd", "/c"] + command
process = subprocess.Popen(command, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, shell=True)
data = process.communicate(input=data)[0]
I'm working around #33 to try and test it. With this patch applied I have successfully generated an output directory.
The issue appears to be that npm stores its scripts in .cmd
files that are roughly equivalent to .sh
files on Posix systems. However, since Windows has no concept of a shebang it doesn't actually know to run it. The trick is to run it under a shell, similar to how you might run bash -c
. I'm not sure why shell=True
doesn't actually accomplish this, but prefixing the command with cmd /c
does the trick.
I will no longer using npx in favor of calling stub scripts with node directly for running the various tools. In the mean time, this has been merged.
I'm still trying to track this one down, and in the meantime I'm opening this issue to document my findings.
The
espfs
build will silently fail on Windows when compressing files usingnpx
:This is despite the fact that the
npx
command exists and is capable of running commands:The compilation does not fail when this occurs, and instead generates empty files.
Possible reasons for this:
npx html-minifier
, it's supposed to call"npx" "html-minifier"
idf.py
shell is replacingPATH
with one that is cleaned of any system PATH entriescmd.exe
andpowershell
, however this is less likely because the error occurs as well withcmd.exe
without powershellThere are two issues here:
npx
on Windows even though it exists and is on the PATH