Skip to content

Commit f34b166

Browse files
CopilotTomeHirata
andcommitted
Fix Windows directory creation error in runner.js by using analyzePath
Co-authored-by: TomeHirata <[email protected]>
1 parent 88b6391 commit f34b166

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dspy/primitives/runner.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ for await (const line of readLines(Deno.stdin)) {
4242
for (const d of dirs) {
4343
cur += '/' + d;
4444
try {
45-
pyodide.FS.mkdir(cur);
46-
} catch (e) {
47-
if (!(e && e.message && e.message.includes('File exists'))) {
48-
console.log("[DEBUG] Error creating directory in Pyodide file system:", cur, "|", e.message);
45+
const pathInfo = pyodide.FS.analyzePath(cur);
46+
if (!pathInfo.exists) {
47+
pyodide.FS.mkdir(cur);
4948
}
49+
} catch (e) {
50+
console.log("[DEBUG] Error creating directory in Pyodide file system:", cur, "|", e.message);
5051
}
5152
}
5253
pyodide.FS.writeFile(virtualPath, contents);

0 commit comments

Comments
 (0)