Skip to content

Commit c4b8ebb

Browse files
committed
Adding fix that is already applied in maven plugin
1 parent f4581bf commit c4b8ebb

File tree

1 file changed

+6
-3
lines changed
  • graalpython/org.graalvm.python.embedding.utils/src/org/graalvm/python/embedding/utils/jbang

1 file changed

+6
-3
lines changed

graalpython/org.graalvm.python.embedding.utils/src/org/graalvm/python/embedding/utils/jbang/JBangIntegration.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,16 @@ private static void generateLaunchers(List<Map.Entry<String, Path>> dependencies
262262
// on windows, generate a venv launcher that executes our mvn target
263263
var script = String.format("""
264264
import os, shutil, struct, venv
265+
from pathlib import Path
265266
vl = os.path.join(venv.__path__[0], 'scripts', 'nt', 'graalpy.exe')
266267
tl = os.path.join(r'%s')
268+
os.makedirs(Path(tl).parent.absolute())
267269
shutil.copy(vl, tl)
268270
cmd = r'mvn.cmd -f "%s" graalpy:exec "-Dexec.workingdir=%s"'
269-
with open(tl, 'ab') as f:
270-
sz = f.write(cmd.encode('utf-16le'))
271-
f.write(struct.pack("@I", sz)) == 4
271+
pyvenvcfg = os.path.join(os.path.dirname(tl), "pyvenv.cfg")
272+
with open(pyvenvcfg, 'w', encoding='utf-8') as f:
273+
f.write('venvlauncher_command = ')
274+
f.write(cmd)
272275
""",
273276
launcher,
274277
Paths.get(projectPath, "pom.xml").toString(),

0 commit comments

Comments
 (0)