diff options
author | Ry Dahl <ry@tinyclouds.org> | 2019-11-03 10:39:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-03 10:39:27 -0500 |
commit | 86b3ac5108e2893091475a0318fcba6c14e19140 (patch) | |
tree | 11c977dcad8271cc047e5707130b0811507370c4 /cli/lib.rs | |
parent | 65e91796720ea68d69ac7f925a8f239aee8fb19e (diff) |
feat: lockfiles (#3231)
Use --lock-write=lock.json or --lock-check=lock.json on the command
line.
Diffstat (limited to 'cli/lib.rs')
-rw-r--r-- | cli/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/lib.rs b/cli/lib.rs index 5e416c6ac..4f5319508 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -17,6 +17,7 @@ extern crate serde; extern crate serde_derive; extern crate url; +mod checksum; pub mod colors; pub mod compilers; pub mod deno_dir; @@ -32,6 +33,7 @@ mod http_body; mod http_util; mod import_map; mod js; +mod lockfile; pub mod msg; pub mod ops; pub mod permissions; @@ -363,6 +365,18 @@ fn run_script(flags: DenoFlags, argv: Vec<String>) { worker .execute_mod_async(&main_module, None, false) .and_then(move |()| { + if state.flags.lock_write { + if let Some(ref lockfile) = state.lockfile { + let g = lockfile.lock().unwrap(); + g.write()?; + } else { + eprintln!("--lock flag must be specified when using --lock-write"); + std::process::exit(11); + } + } + Ok(()) + }) + .and_then(move |()| { js_check(worker.execute("window.dispatchEvent(new Event('load'))")); worker.then(move |result| { js_check(result); |