Skip to main content

os.getcwd

The os.getcwd function returns the script's current absolute execution directory. It is the same path returned by fs.resolve(".").

Usage​

os.getcwd()

The initial value is the script's configured working directory. os.chdir changes it for the rest of that invocation. This is script-local state; it does not change Atmos's host process directory.

Examples​

original = os.getcwd()
os.chdir("scripts")
exec.run(["my-tool", "--version"])
os.chdir(original)
  • os.chdir changes the script's execution directory.
  • fs.resolve resolves a path against that directory.