diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2020-01-26 10:43:59 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2020-01-26 13:43:59 -0500 |
commit | ec44be0760d647b3d005387d2f44ad0336d01024 (patch) | |
tree | a23d962ba972a4c47646bf0facac4ec2e47846ef /cli/lib.rs | |
parent | 9d98f0126c5e19704b273579acf40132a38ce43b (diff) |
lock: support lock-write for fetch command (#3787)
Diffstat (limited to 'cli/lib.rs')
-rw-r--r-- | cli/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/lib.rs b/cli/lib.rs index 3b174bb75..311d8ce30 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -289,6 +289,17 @@ fn fetch_command(flags: DenoFlags) { let main_future = async move { let result = worker.execute_mod_async(&main_module, None, true).await; js_check(result); + if state.flags.lock_write { + if let Some(ref lockfile) = state.lockfile { + let g = lockfile.lock().unwrap(); + if let Err(e) = g.write() { + print_err_and_exit(ErrBox::from(e)); + } + } else { + eprintln!("--lock flag must be specified when using --lock-write"); + std::process::exit(11); + } + } }; tokio_util::run(main_future); |