Function in env compiler

cwd

fn cwd() -> Result<string, EnvError>
Import
use env::{cwd};
Source: compiler/src/builtin_docs/env.hy

Returns the current working directory as an absolute path.

Returns Err(EnvError::Other) if it cannot be read (for example when it was deleted). Needs no permission.

Returns#

Result<string, EnvError>

Examples#

use env::{cwd};
use tests::assert;
let dir = match cwd() {
    Result::Ok(d) => d,
    Result::Err(_) => "",
};
assert!(dir.len() > 0);

See also#

  • args: Returns the program’s command-line arguments, starting with the program name.
  • var: Returns the value of the environment variable name.
  • set_var: Sets the environment variable name to value for this process.
  • remove_var: Removes the environment variable name from this process.
  • set_cwd: Changes the current working directory of the whole process.
  • exit: Ends the process at once with exit status code.
  • exec: Runs program with the arguments argv and waits for it to finish.
↑ ↓ navigate ↵ open