mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
d46b37f6a8
Raise the soft limit to the hard limit when possible. This is similar to what Node.js does to avoid running into "out of file descriptors" errors too quickly. On most Linux systems, raises the limit from 1,024 to 1,048,576. On most macOS systems, raises the limit from 256 to 10,240. Fixes #10148.
31 lines
844 B
Rust
31 lines
844 B
Rust
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
|
|
|
#![deny(warnings)]
|
|
|
|
mod colors;
|
|
mod standalone;
|
|
mod tokio_util;
|
|
mod unix_util;
|
|
mod version;
|
|
|
|
use deno_core::error::anyhow;
|
|
use deno_core::error::AnyError;
|
|
use std::env;
|
|
|
|
pub fn main() {
|
|
#[cfg(windows)]
|
|
colors::enable_ansi(); // For Windows 10
|
|
unix_util::raise_fd_limit();
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
if let Err(err) = run(args) {
|
|
eprintln!("{}: {}", colors::red_bold("error"), err.to_string());
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
|
|
fn run(args: Vec<String>) -> Result<(), AnyError> {
|
|
let (metadata, bundle) = standalone::extract_standalone(args)?
|
|
.ok_or_else(|| anyhow!("This executable is used internally by 'deno compile', it is not meant to be invoked directly."))?;
|
|
tokio_util::run_basic(standalone::run(bundle, metadata))
|
|
}
|