srvc: fix build on darwin, set meta.mainProgram

This commit is contained in:
figsoda 2022-11-10 13:14:30 -05:00
parent caad67c4a1
commit d1f31de066
2 changed files with 41 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, rustPlatform, stdenv, Security }:
{ lib, rustPlatform, fetchFromGitHub, stdenv, Security }:
rustPlatform.buildRustPackage rec {
pname = "srvc";
@ -13,6 +13,9 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "sha256-nJM7/w4awbCZQysUOSTO6bfsBXO3agJRdp1RyRZhtUY=";
# remove timeouts in tests to make them less flaky
patches = [ ./tests-no-timeout.patch ];
buildInputs = lib.optionals stdenv.isDarwin [
Security
];
@ -22,5 +25,6 @@ rustPlatform.buildRustPackage rec {
homepage = "https://github.com/insilica/rs-srvc";
license = licenses.asl20;
maintainers = with maintainers; [ john-shaffer ];
mainProgram = "sr";
};
}

View file

@ -0,0 +1,36 @@
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1,15 +1,13 @@
#![allow(dead_code)]
use std::path::PathBuf;
-use std::time::Duration;
use assert_cmd::Command;
#[cfg(unix)]
use rexpect::session::PtySession;
-pub fn cmd(timeout_millis: u64) -> Command {
+pub fn cmd(_: u64) -> Command {
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
- cmd.timeout(Duration::from_millis(timeout_millis));
cmd.env_remove("RUST_BACKTRACE");
cmd
}
@@ -19,14 +17,14 @@ pub fn spawn(
dir: &str,
args: Vec<&str>,
timestamp_override: u64,
- timeout_millis: u64,
+ _: u64,
) -> Result<PtySession, rexpect::errors::Error> {
let mut cmd = std::process::Command::new(env!("CARGO_BIN_EXE_sr"));
cmd.args(args);
cmd.current_dir(dir);
cmd.env("SR_TIMESTAMP_OVERRIDE", timestamp_override.to_string());
cmd.env_remove("RUST_BACKTRACE");
- Ok(rexpect::session::spawn_command(cmd, Some(timeout_millis))?)
+ rexpect::session::spawn_command(cmd, None)
}
pub fn remove_sink(dir: &str) -> Result<(), std::io::Error> {