Javet icon indicating copy to clipboard operation
Javet copied to clipboard

Delete working directory error

Open LittleSnailzs opened this issue 1 year ago • 6 comments

Hello, I have encountered a problem I have called NodeRuntime.close(), but the path corresponding to the working directory still cannot be deleted

LittleSnailzs avatar Aug 21 '24 08:08 LittleSnailzs

I think you'd better chdir to somewhere else before doing so.

caoccao avatar Aug 21 '24 09:08 caoccao

const path = require('path');
const { chdir, cwd } = require('process');

const rootDir = cwd();
try {
  ...
} finally {
    chdir(path.dirname(rootDir));
}

@caoccao like this ?

lilithyang2018 avatar Aug 23 '24 00:08 lilithyang2018

Something like that.

caoccao avatar Aug 23 '24 01:08 caoccao

@caoccao it seems that the V8FileExecutor does not release the js file after NodeRuntime is closed, so the file is always occupied by the java process. any suggestions ?

lilithyang2018 avatar Aug 26 '24 09:08 lilithyang2018

It's quite unusual to delete the script. Please use the other executors instead.

caoccao avatar Aug 26 '24 09:08 caoccao

ok, i'll try V8StringExecutor instead

lilithyang2018 avatar Aug 26 '24 10:08 lilithyang2018