Skip to content

Commit 434118f

Browse files
committed
Fix s windows issue
1 parent a306a00 commit 434118f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/ndarray/test_dsl_js.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
"""
1313

1414
import json
15+
import os
1516
import shutil
1617
import subprocess
1718
import sys
19+
import tempfile
1820

1921
import numpy as np
2022
import pytest
@@ -91,7 +93,13 @@ def _run_node(module, pts, scalars):
9193
{cols}__run([{ops}], [{isarr}], out, pts.length);
9294
console.log(JSON.stringify(Array.from(out)));
9395
"""
94-
res = subprocess.run([node, "-e", prog], capture_output=True, text=True)
96+
# Write to a temp file rather than `node -e <prog>`: a big inlined program (the points
97+
# are JSON-embedded) overflows the Windows command-line length limit (WinError 206).
98+
with tempfile.TemporaryDirectory() as d:
99+
script = os.path.join(d, "dsl_js_check.js")
100+
with open(script, "w", encoding="utf-8") as fh:
101+
fh.write(prog)
102+
res = subprocess.run([node, script], capture_output=True, text=True)
95103
if res.returncode != 0:
96104
raise AssertionError(f"node failed:\n{res.stderr}")
97105
return json.loads(res.stdout)

0 commit comments

Comments
 (0)