0

In NodeJS, I need to "access" a running VSCode instance and see if the current working directory is a specific folder, i.e. "/home/foobar/Desktop/myproject".

Is that possible in NodeJS?

starball
  • 20,030
  • 7
  • 43
  • 238
user3601578
  • 1,310
  • 1
  • 18
  • 29

1 Answers1

1

On Unix systems, see Find out current working directory of a running process? (pwdx <PID> and other methods). On Windows systems, see windows batch command to determine working directory of a process (suggestions to install non-native programs that do the job) and Is it possible to determine the working directory of another process? (how to do it with the Windows API, which I don't know if is accessible directly via NodeJS). At least on UNIX systems, you could just use child_process (see also Execute a command line binary with Node.js).

starball
  • 20,030
  • 7
  • 43
  • 238
  • Thank you. I accepted this answer, even though I subconsciously expected some code. But I forgot to ask that in the original question. Hence, could you provide some code? But your answer is accepted, thank you. – user3601578 Mar 23 '23 at 10:57