mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Use proper npm arguments and clean its inherited env vars (#3419)
Previously, `npm i` command could take too much time to download dependencies, which was caused by wrong flags used. Since we run `node` and `npm` processes ourselves and try to isolate them from potentially "bad" user configs, it seems safer to remove any ways to re-configure the tools via env vars, so strip off those too. Release Notes: - N/A
This commit is contained in:
commit
4a01726e5e
1 changed files with 8 additions and 6 deletions
|
@ -73,6 +73,7 @@ impl RealNodeRuntime {
|
||||||
let npm_file = node_dir.join("bin/npm");
|
let npm_file = node_dir.join("bin/npm");
|
||||||
|
|
||||||
let result = Command::new(&node_binary)
|
let result = Command::new(&node_binary)
|
||||||
|
.env_clear()
|
||||||
.arg(npm_file)
|
.arg(npm_file)
|
||||||
.arg("--version")
|
.arg("--version")
|
||||||
.stdin(Stdio::null())
|
.stdin(Stdio::null())
|
||||||
|
@ -149,6 +150,7 @@ impl NodeRuntime for RealNodeRuntime {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut command = Command::new(node_binary);
|
let mut command = Command::new(node_binary);
|
||||||
|
command.env_clear();
|
||||||
command.env("PATH", env_path);
|
command.env("PATH", env_path);
|
||||||
command.arg(npm_file).arg(subcommand);
|
command.arg(npm_file).arg(subcommand);
|
||||||
command.args(["--cache".into(), installation_path.join("cache")]);
|
command.args(["--cache".into(), installation_path.join("cache")]);
|
||||||
|
@ -200,11 +202,11 @@ impl NodeRuntime for RealNodeRuntime {
|
||||||
&[
|
&[
|
||||||
name,
|
name,
|
||||||
"--json",
|
"--json",
|
||||||
"-fetch-retry-mintimeout",
|
"--fetch-retry-mintimeout",
|
||||||
"2000",
|
"2000",
|
||||||
"-fetch-retry-maxtimeout",
|
"--fetch-retry-maxtimeout",
|
||||||
"5000",
|
"5000",
|
||||||
"-fetch-timeout",
|
"--fetch-timeout",
|
||||||
"5000",
|
"5000",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -229,11 +231,11 @@ impl NodeRuntime for RealNodeRuntime {
|
||||||
|
|
||||||
let mut arguments: Vec<_> = packages.iter().map(|p| p.as_str()).collect();
|
let mut arguments: Vec<_> = packages.iter().map(|p| p.as_str()).collect();
|
||||||
arguments.extend_from_slice(&[
|
arguments.extend_from_slice(&[
|
||||||
"-fetch-retry-mintimeout",
|
"--fetch-retry-mintimeout",
|
||||||
"2000",
|
"2000",
|
||||||
"-fetch-retry-maxtimeout",
|
"--fetch-retry-maxtimeout",
|
||||||
"5000",
|
"5000",
|
||||||
"-fetch-timeout",
|
"--fetch-timeout",
|
||||||
"5000",
|
"5000",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue