Waiting for space.writePage to finish?

Currently I’m experimenting with some exports.

So far so good, I’m able to read the pagecontent, render it and so on.

So my last two steps are space.writePage(…) and then shell.run(…) to convert my exported file in a shell.

The problem is now, space.writePage seems to take a bit to write the file and my shell-command seem to run BEFORE space.writePage has finished writing….

Is there a way in LUA to wait for space.writePage is finished?
Or could we add a sleep-function? It takes only 1-2 sec, so just wait for a sec should not be a problem :slight_smile:

Currently I just added a editor.confirm(“Wait..”), but I’m looking for a more elegant way :wink:
Plan B is to run a shell script with a sleep in it, instead of running my EXE directly from lua…

Just realized, it might be a issue with sync instead, if space.writePage is working locally on the browser session and my shellcommand is running on the server.

So we might have to wait for a sync to complete…

Well, seems like adding “sync.scheduleFileSync(filename)” between both commands is working…