In my understanding from How to run shell script file using nodejs?, this code should give me the current directory of the js file:
exec('dir', {cwd: "." }, (error, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
if (error !== null) {
console.log(`exec error: ${error}`);
}
});
But the result is another directory. How to fix this? I'm on Windows 11 Home, and use esbuild to bundle ts to js.