What's the difference between process.cwd() vs process.env.PWD?

前端 未结 1 729
生来不讨喜
生来不讨喜 2021-02-13 04:02

Both \"return the current working directory of the process\".

It seems you can override the value of process.env.PWD<

1条回答
  •  滥情空心
    2021-02-13 04:45

    PWD is the current working directory when the process is started, but it is constant. process.cwd() is asking the underlying system for the process's current directory, which can be changed with process.chdir(). PWD is also a POSIX environmental variable, which means it won't work on Windows. process.cwd() on the other hand, will.

    0 讨论(0)
提交回复
热议问题