Add a 5s timeout when running npm info
and npm install
This prevents those two commands from getting stuck when there is no internet connection.
This commit is contained in:
parent
9779663c6b
commit
2c1fd7b0bf
1 changed files with 4 additions and 0 deletions
|
@ -37,6 +37,8 @@ pub(crate) struct GithubReleaseAsset {
|
|||
|
||||
pub async fn npm_package_latest_version(name: &str) -> Result<String> {
|
||||
let output = smol::process::Command::new("npm")
|
||||
.args(["-fetch-retry-mintimeout", "2000"])
|
||||
.args(["-fetch-retry-maxtimeout", "5000"])
|
||||
.args(["info", name, "--json"])
|
||||
.output()
|
||||
.await
|
||||
|
@ -60,6 +62,8 @@ pub async fn npm_install_packages(
|
|||
directory: &Path,
|
||||
) -> Result<()> {
|
||||
let output = smol::process::Command::new("npm")
|
||||
.args(["-fetch-retry-mintimeout", "2000"])
|
||||
.args(["-fetch-retry-maxtimeout", "5000"])
|
||||
.arg("install")
|
||||
.arg("--prefix")
|
||||
.arg(directory)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue