From 86b3ac5108e2893091475a0318fcba6c14e19140 Mon Sep 17 00:00:00 2001 From: Ry Dahl Date: Sun, 3 Nov 2019 10:39:27 -0500 Subject: feat: lockfiles (#3231) Use --lock-write=lock.json or --lock-check=lock.json on the command line. --- cli/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cli/lib.rs') 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; @@ -362,6 +364,18 @@ fn run_script(flags: DenoFlags, argv: Vec) { 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| { -- cgit v1.2.3