aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/process_executor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/util/process_executor.rs')
-rw-r--r--crates/shirabe/src/util/process_executor.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/shirabe/src/util/process_executor.rs b/crates/shirabe/src/util/process_executor.rs
index 2954ed7a..2bfaeb94 100644
--- a/crates/shirabe/src/util/process_executor.rs
+++ b/crates/shirabe/src/util/process_executor.rs
@@ -7,7 +7,7 @@ use crate::signal::SignalSubscription;
use crate::util::GitHub;
use crate::util::Platform;
use indexmap::IndexMap;
-use shirabe_pcre::{CaptureKey, Preg, PregMatches};
+use shirabe_pcre::{Preg, PregMatches};
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
LogicException, PHP_EOL, PhpMixed, RuntimeException, array_intersect, array_map,
@@ -219,10 +219,7 @@ impl ProcessExecutor {
if Platform::is_windows()
&& let Some(m) = Preg::is_match3(php_regex!(r"{^([^:/\\]++) }"), &command_str)
{
- let m1 = m
- .get(&CaptureKey::ByIndex(1))
- .unwrap_or_default()
- .to_string();
+ let m1 = m.get(1).unwrap_or_default().to_string();
command_str = substr_replace(
&command_str,
&Self::escape(&Self::get_executable(&m1)),
@@ -835,19 +832,18 @@ impl ProcessExecutor {
let safe_command = Preg::replace_callback(
php_regex!(r"{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i"),
|m: &PregMatches| -> String {
- let user_key = CaptureKey::ByName("user".to_string());
// if the username looks like a long (12char+) hex string, or a modern github token (e.g. ghp_xxx, github_pat_xxx) we obfuscate that
if Preg::is_match(
GitHub::GITHUB_TOKEN_REGEX,
- m.get(&user_key).unwrap_or_default(),
+ m.name("user").unwrap_or_default(),
) {
return "://***:***@".to_string();
}
- if Preg::is_match(r"{^[a-f0-9]{12,}$}", m.get(&user_key).unwrap_or_default()) {
+ if Preg::is_match(r"{^[a-f0-9]{12,}$}", m.name("user").unwrap_or_default()) {
return "://***:***@".to_string();
}
- format!("://{}:***@", m.get(&user_key).unwrap_or_default())
+ format!("://{}:***@", m.name("user").unwrap_or_default())
},
&command_string,
);