summaryrefslogtreecommitdiff
path: root/cli/bench/throughput.rs
diff options
context:
space:
mode:
authorTrivikram Kamat <16024985+trivikr@users.noreply.github.com>2020-08-31 08:48:58 -0700
committerGitHub <noreply@github.com>2020-08-31 11:48:58 -0400
commit0071dfdc5ced9a717c7b5008e20bf79f1b6dc78a (patch)
tree8a67a600a0aecdb5f6f4c396f84760d834cf0486 /cli/bench/throughput.rs
parent15fd1e8d3048653ad7b9afc8738010c5b3f0c2e1 (diff)
update actions to run on ubuntu-18.04 (#7160)
Diffstat (limited to 'cli/bench/throughput.rs')
-rw-r--r--cli/bench/throughput.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/cli/bench/throughput.rs b/cli/bench/throughput.rs
index 0be46f142..74844fbed 100644
--- a/cli/bench/throughput.rs
+++ b/cli/bench/throughput.rs
@@ -34,7 +34,17 @@ pub(crate) fn cat(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
pub(crate) fn tcp(deno_exe: &PathBuf, megs: usize) -> Result<Value> {
let size = megs * MB;
- let shell_cmd = format!("head -c {} /dev/zero | nc {}", size, CLIENT_ADDR);
+ // The GNU flavor of `nc` requires the `-N` flag to shutdown the network socket after EOF on stdin
+ let nc_command = if cfg!(target_os = "linux") {
+ "nc -N"
+ } else {
+ "nc"
+ };
+
+ let shell_cmd = format!(
+ "head -c {} /dev/zero | {} {}",
+ size, nc_command, CLIENT_ADDR
+ );
println!("{}", shell_cmd);
let cmd = &["sh", "-c", &shell_cmd];