aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/shirabe-php-shim/src/lib.rs4
-rw-r--r--crates/shirabe/src/factory.rs2
-rw-r--r--crates/shirabe/src/main.rs4
-rw-r--r--crates/shirabe/src/util/platform.rs10
4 files changed, 7 insertions, 13 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs
index 9255ee7..1bcd03c 100644
--- a/crates/shirabe-php-shim/src/lib.rs
+++ b/crates/shirabe-php-shim/src/lib.rs
@@ -1820,10 +1820,6 @@ pub fn server_contains_key(_name: &str) -> bool {
todo!()
}
-pub fn server_argv() -> Vec<String> {
- todo!()
-}
-
/// PHP superglobal $_ENV access
pub fn env_get(_name: &str) -> Option<String> {
todo!()
diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs
index 6d788f4..975c558 100644
--- a/crates/shirabe/src/factory.rs
+++ b/crates/shirabe/src/factory.rs
@@ -1328,7 +1328,7 @@ impl Factory {
static mut WARNED: bool = false;
let mut disable_tls = false;
// allow running the config command if disable-tls is in the arg list, even if openssl is missing, to allow disabling it via the config command
- let argv = shirabe_php_shim::server_argv();
+ let argv: Vec<String> = std::env::args().collect();
if !argv.is_empty()
&& argv.contains(&"disable-tls".to_string())
&& (argv.contains(&"conf".to_string()) || argv.contains(&"config".to_string()))
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index 5c9dd9b..8ba695f 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -2,7 +2,7 @@
use shirabe::console::Application;
use shirabe::util::Platform;
-use shirabe_php_shim::{realpath, server_argv};
+use shirabe_php_shim::realpath;
fn main() {
// TODO(phase-c): the full initialization process in composer/bin/composer should be ported
@@ -10,7 +10,7 @@ fn main() {
Platform::put_env(
"COMPOSER_BINARY",
- &realpath(&server_argv()[0]).unwrap_or_default(),
+ &realpath(&std::env::args().next().unwrap_or_default()).unwrap_or_default(),
);
// run the command application
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs
index 08f5007..ecf2338 100644
--- a/crates/shirabe/src/util/platform.rs
+++ b/crates/shirabe/src/util/platform.rs
@@ -8,8 +8,8 @@ use shirabe_php_shim::{
PhpMixed, RuntimeException, defined, env_contains_key, env_get, env_set, env_unset,
file_exists, file_get_contents, fopen, fstat, function_exists, getcwd, getenv, in_array,
ini_get, is_array, is_readable, mb_strlen, php_os_family, posix_geteuid, posix_getpwuid,
- posix_getuid, posix_isatty, putenv, realpath, server_argv, server_contains_key, server_get,
- server_set, server_unset, stream_isatty, stripos, strlen, strtoupper, substr, usleep,
+ posix_getuid, posix_isatty, putenv, realpath, server_contains_key, server_get, server_set,
+ server_unset, stream_isatty, stripos, strlen, strtoupper, substr, usleep,
};
use crate::util::ProcessExecutor;
@@ -349,11 +349,9 @@ impl Platform {
false
}
- /// @return bool Whether the current command is for bash completion
+ /// Whether the current command is for bash completion
pub fn is_input_completion_process() -> bool {
- // PHP: $_SERVER['argv'][1] ?? null
- let argv = server_argv();
- argv.get(1).map(|s| s.as_str()) == Some("_complete")
+ std::env::args().nth(1).as_deref() == Some("_complete")
}
pub fn workaround_filesystem_issues() {