mirror of
https://github.com/denoland/deno.git
synced 2025-01-22 06:09:25 -05:00
parent
fb90c6f525
commit
1322f3de9f
5 changed files with 25 additions and 10 deletions
|
@ -8,6 +8,7 @@ import { libdeno } from "./libdeno";
|
|||
import { args } from "./deno";
|
||||
import { sendSync, handleAsyncMsgFromRust } from "./dispatch";
|
||||
import { promiseErrorExaminer, promiseRejectHandler } from "./promise_util";
|
||||
import { version } from "typescript";
|
||||
|
||||
function sendStart(): msg.StartRes {
|
||||
const builder = new flatbuffers.Builder();
|
||||
|
@ -59,6 +60,14 @@ export default function denoMain() {
|
|||
os.exit(0);
|
||||
}
|
||||
|
||||
// handle `--version`
|
||||
if (startResMsg.versionFlag()) {
|
||||
console.log("deno:", startResMsg.denoVersion());
|
||||
console.log("v8:", startResMsg.v8Version());
|
||||
console.log("typescript:", version);
|
||||
os.exit(0);
|
||||
}
|
||||
|
||||
const cwd = startResMsg.cwd();
|
||||
log("cwd", cwd);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::ffi::CString;
|
|||
use std::mem;
|
||||
use std::process::exit;
|
||||
use std::vec::Vec;
|
||||
use version;
|
||||
|
||||
// Creates vector of strings, Vec<String>
|
||||
#[cfg(test)]
|
||||
|
@ -35,11 +34,6 @@ pub fn process(flags: &DenoFlags) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
if flags.version {
|
||||
version::print_version();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
let mut log_level = log::LevelFilter::Info;
|
||||
if flags.log_debug {
|
||||
log_level = log::LevelFilter::Debug;
|
||||
|
|
|
@ -121,6 +121,9 @@ table StartRes {
|
|||
deps_flag: bool;
|
||||
recompile_flag: bool;
|
||||
types_flag: bool;
|
||||
version_flag: bool;
|
||||
deno_version: string;
|
||||
v8_version: string;
|
||||
}
|
||||
|
||||
table CodeFetch {
|
||||
|
|
10
src/ops.rs
10
src/ops.rs
|
@ -12,6 +12,7 @@ use msg;
|
|||
use resources;
|
||||
use resources::Resource;
|
||||
use tokio_util;
|
||||
use version;
|
||||
|
||||
use flatbuffers::FlatBufferBuilder;
|
||||
use futures;
|
||||
|
@ -178,6 +179,12 @@ fn op_start(
|
|||
let cwd_off =
|
||||
builder.create_string(deno_fs::normalize_path(cwd_path.as_ref()).as_ref());
|
||||
|
||||
let v8_version = version::get_v8_version();
|
||||
let v8_version_off = builder.create_string(v8_version);
|
||||
|
||||
let deno_version = version::DENO_VERSION;
|
||||
let deno_version_off = builder.create_string(deno_version);
|
||||
|
||||
let inner = msg::StartRes::create(
|
||||
&mut builder,
|
||||
&msg::StartResArgs {
|
||||
|
@ -186,6 +193,9 @@ fn op_start(
|
|||
debug_flag: state.flags.log_debug,
|
||||
recompile_flag: state.flags.recompile,
|
||||
types_flag: state.flags.types_flag,
|
||||
version_flag: state.flags.version,
|
||||
v8_version: Some(v8_version_off),
|
||||
deno_version: Some(deno_version_off),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
|
|
@ -3,12 +3,11 @@ use libdeno;
|
|||
use std::ffi::CStr;
|
||||
|
||||
// This is the source of truth for the Deno version. Ignore the value in Cargo.toml.
|
||||
const DENO_VERSION: &str = "0.1.8";
|
||||
pub const DENO_VERSION: &str = "0.1.8";
|
||||
|
||||
pub fn print_version() {
|
||||
pub fn get_v8_version() -> &'static str {
|
||||
let v = unsafe { libdeno::deno_v8_version() };
|
||||
let c_str = unsafe { CStr::from_ptr(v) };
|
||||
let version = c_str.to_str().unwrap();
|
||||
println!("deno: {}", DENO_VERSION);
|
||||
println!("v8: {}", version);
|
||||
version
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue