Skip to content

Commit

Permalink
Fix syncfs by populating first (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored May 16, 2024
1 parent 1082db9 commit aaf7783
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion public/chat/pyodide-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@ self.onmessage = async (event) => {
self.pyodide.globals.set("source", source)
self.pyodide.globals.set("io_context", io_context && self.pyodide.toPy(io_context))
outputs = []
// copy mounted files into pyodide
for(const mountPoint of Object.keys(mountedFs)){
await mountedFs[mountPoint].syncfs(true)
}
await self.pyodide.runPythonAsync("await run(source, io_context)")
// synchronize the file system
// copy files back to the native fs
for(const mountPoint of Object.keys(mountedFs)){
await mountedFs[mountPoint].syncfs()
}
Expand Down

0 comments on commit aaf7783

Please sign in to comment.