Creates the `node` script that will replace the `node` binary while running Returns the path to the script folder, which should be added to the PATH environment variable
()
| 6 | /// Creates the `node` script that will replace the `node` binary while running |
| 7 | /// Returns the path to the script folder, which should be added to the PATH environment variable |
| 8 | pub(crate) fn setup() -> Result<PathBuf> { |
| 9 | let script_folder = env::temp_dir().join("codspeed_introspected_node"); |
| 10 | std::fs::create_dir_all(&script_folder)?; |
| 11 | let script_path = script_folder.join("node"); |
| 12 | let mut script_file = File::create(script_path)?; |
| 13 | script_file.write_all(INTROSPECTED_NODE_SCRIPT.as_bytes())?; |
| 14 | // Make the script executable |
| 15 | let mut perms = script_file.metadata()?.permissions(); |
| 16 | perms.set_mode(0o755); |
| 17 | script_file.set_permissions(perms)?; |
| 18 | Ok(script_folder) |
| 19 | } |
no outgoing calls
no test coverage detected