File tree 2 files changed +6
-24
lines changed
2 files changed +6
-24
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub struct BenchGuard {
14
14
}
15
15
16
16
impl BenchGuard {
17
- pub fn new < P : Into < PathBuf > > ( ctl_fifo : P , ack_fifo : P ) -> anyhow:: Result < Self > {
17
+ pub fn new ( ctl_fifo : & str , ack_fifo : & str ) -> anyhow:: Result < Self > {
18
18
let mut instance = Self {
19
19
ctl_fifo : FifoIpc :: connect ( ctl_fifo) ?. with_writer ( ) ?,
20
20
ack_fifo : FifoIpc :: connect ( ack_fifo) ?. with_reader ( ) ?,
@@ -24,7 +24,7 @@ impl BenchGuard {
24
24
}
25
25
26
26
pub fn new_with_runner_fifo ( ) -> anyhow:: Result < Self > {
27
- Self :: new ( runner_ctl_fifo_path ( ) ? , runner_ack_fifo_path ( ) ? )
27
+ Self :: new ( RUNNER_CTL_FIFO , RUNNER_ACK_FIFO )
28
28
}
29
29
30
30
fn send_cmd ( & mut self , cmd : Command ) -> anyhow:: Result < ( ) > {
@@ -43,10 +43,10 @@ impl Drop for BenchGuard {
43
43
}
44
44
45
45
pub fn send_cmd ( cmd : Command ) -> anyhow:: Result < ( ) > {
46
- let mut writer = FifoIpc :: connect ( runner_ctl_fifo_path ( ) ? ) ?. with_writer ( ) ?;
46
+ let mut writer = FifoIpc :: connect ( RUNNER_CTL_FIFO ) ?. with_writer ( ) ?;
47
47
writer. send_cmd ( cmd) . unwrap ( ) ;
48
48
49
- let mut reader = FifoIpc :: connect ( runner_ack_fifo_path ( ) ? ) ?. with_reader ( ) ?;
49
+ let mut reader = FifoIpc :: connect ( RUNNER_ACK_FIFO ) ?. with_reader ( ) ?;
50
50
reader. wait_for_ack ( ) ;
51
51
52
52
Ok ( ( ) )
Original file line number Diff line number Diff line change 1
- use std:: path:: PathBuf ;
2
-
3
- use anyhow:: Context ;
4
-
5
1
// !!!!!!!!!!!!!!!!!!!!!!!!
6
2
// !! DO NOT TOUCH BELOW !!
7
3
// !!!!!!!!!!!!!!!!!!!!!!!!
8
4
// Has to be in sync with `runner`.
9
5
//
10
- const RUNNER_CTL_FIFO_NAME : & str = "runner.ctl.fifo" ;
11
- const RUNNER_ACK_FIFO_NAME : & str = "runner.ack.fifo" ;
12
-
13
- pub fn runner_fifo_dir ( ) -> anyhow:: Result < PathBuf > {
14
- let raw_path = std:: env:: var ( "CODSPEED_FIFO_DIR" )
15
- . context ( "CODSPEED_FIFO_DIR environment variable not set" ) ?;
16
- Ok ( PathBuf :: from ( raw_path) )
17
- }
18
-
19
- pub fn runner_ctl_fifo_path ( ) -> anyhow:: Result < PathBuf > {
20
- runner_fifo_dir ( ) . map ( |p| p. join ( RUNNER_CTL_FIFO_NAME ) )
21
- }
22
-
23
- pub fn runner_ack_fifo_path ( ) -> anyhow:: Result < PathBuf > {
24
- runner_fifo_dir ( ) . map ( |p| p. join ( RUNNER_ACK_FIFO_NAME ) )
25
- }
6
+ pub const RUNNER_CTL_FIFO : & str = "/tmp/runner.ctl.fifo" ;
7
+ pub const RUNNER_ACK_FIFO : & str = "/tmp/runner.ack.fifo" ;
26
8
27
9
#[ derive( serde:: Serialize , serde:: Deserialize , Debug , PartialEq ) ]
28
10
pub enum Command {
You can’t perform that action at this time.
0 commit comments