mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
parent
08ec6e5831
commit
86cdf37033
5 changed files with 13 additions and 9 deletions
|
@ -17,6 +17,7 @@ use deno_runtime::permissions::parse_sys_kind;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::ffi::OsString;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
use std::num::NonZeroU8;
|
use std::num::NonZeroU8;
|
||||||
|
@ -909,7 +910,7 @@ To evaluate code in the shell:
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Main entry point for parsing deno's command line flags.
|
/// Main entry point for parsing deno's command line flags.
|
||||||
pub fn flags_from_vec(args: Vec<String>) -> clap::error::Result<Flags> {
|
pub fn flags_from_vec(args: Vec<OsString>) -> clap::error::Result<Flags> {
|
||||||
let mut app = clap_root();
|
let mut app = clap_root();
|
||||||
let mut matches = app.try_get_matches_from_mut(&args)?;
|
let mut matches = app.try_get_matches_from_mut(&args)?;
|
||||||
|
|
||||||
|
@ -4294,7 +4295,7 @@ mod tests {
|
||||||
|
|
||||||
/// Creates vector of strings, Vec<String>
|
/// Creates vector of strings, Vec<String>
|
||||||
macro_rules! svec {
|
macro_rules! svec {
|
||||||
($($x:expr),* $(,)?) => (vec![$($x.to_string()),*]);
|
($($x:expr),* $(,)?) => (vec![$($x.to_string().into()),*]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -212,7 +212,7 @@ impl TestRun {
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let args = self.get_args();
|
let args = self.get_args();
|
||||||
lsp_log!("Executing test run with arguments: {}", args.join(" "));
|
lsp_log!("Executing test run with arguments: {}", args.join(" "));
|
||||||
let flags = flags_from_vec(args.into_iter().map(String::from).collect())?;
|
let flags = flags_from_vec(args.into_iter().map(From::from).collect())?;
|
||||||
let factory = CliFactory::from_flags(flags)?;
|
let factory = CliFactory::from_flags(flags)?;
|
||||||
// Various test files should not share the same permissions in terms of
|
// Various test files should not share the same permissions in terms of
|
||||||
// `PermissionsContainer` - otherwise granting/revoking permissions in one
|
// `PermissionsContainer` - otherwise granting/revoking permissions in one
|
||||||
|
|
|
@ -320,7 +320,7 @@ pub fn main() {
|
||||||
Box::new(util::draw_thread::DrawThread::show),
|
Box::new(util::draw_thread::DrawThread::show),
|
||||||
);
|
);
|
||||||
|
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<_> = env::args_os().collect();
|
||||||
|
|
||||||
// NOTE(lucacasonato): due to new PKU feature introduced in V8 11.6 we need to
|
// NOTE(lucacasonato): due to new PKU feature introduced in V8 11.6 we need to
|
||||||
// initialize the V8 platform on a parent thread of all threads that will spawn
|
// initialize the V8 platform on a parent thread of all threads that will spawn
|
||||||
|
|
|
@ -68,10 +68,9 @@ fn unwrap_or_exit<T>(result: Result<T, AnyError>) -> T {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<_> = env::args_os().collect();
|
||||||
let current_exe_path = current_exe().unwrap();
|
let current_exe_path = current_exe().unwrap();
|
||||||
let standalone =
|
let standalone = standalone::extract_standalone(¤t_exe_path, args);
|
||||||
standalone::extract_standalone(¤t_exe_path, args.clone());
|
|
||||||
let future = async move {
|
let future = async move {
|
||||||
match standalone {
|
match standalone {
|
||||||
Ok(Some(future)) => {
|
Ok(Some(future)) => {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::env::current_exe;
|
use std::env::current_exe;
|
||||||
|
use std::ffi::OsString;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -239,7 +240,7 @@ pub fn is_standalone_binary(exe_path: &Path) -> bool {
|
||||||
/// the bundle is executed. If not, this function exits with `Ok(None)`.
|
/// the bundle is executed. If not, this function exits with `Ok(None)`.
|
||||||
pub fn extract_standalone(
|
pub fn extract_standalone(
|
||||||
exe_path: &Path,
|
exe_path: &Path,
|
||||||
cli_args: Vec<String>,
|
cli_args: Vec<OsString>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
Option<impl Future<Output = Result<(Metadata, eszip::EszipV2), AnyError>>>,
|
Option<impl Future<Output = Result<(Metadata, eszip::EszipV2), AnyError>>>,
|
||||||
AnyError,
|
AnyError,
|
||||||
|
@ -281,7 +282,10 @@ pub fn extract_standalone(
|
||||||
.context("Failed to read metadata from the current executable")?;
|
.context("Failed to read metadata from the current executable")?;
|
||||||
|
|
||||||
let mut metadata: Metadata = serde_json::from_str(&metadata).unwrap();
|
let mut metadata: Metadata = serde_json::from_str(&metadata).unwrap();
|
||||||
metadata.argv.append(&mut cli_args[1..].to_vec());
|
metadata.argv.reserve(cli_args.len() - 1);
|
||||||
|
for arg in cli_args.into_iter().skip(1) {
|
||||||
|
metadata.argv.push(arg.into_string().unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
Ok((metadata, eszip))
|
Ok((metadata, eszip))
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Add table
Reference in a new issue