changeset 1535:cc006da2a3f6

Added support for -J options * rust-launcher/src/main.rs: arguments are now copied to sub-process in two steps First those with -J prefix are having it stripped and are given to JVM. Those withou J are suffixed to the itw itself
author Jiri Vanek <jvanek@redhat.com>
date Mon, 14 Jan 2019 09:54:38 +0100
parents e5394f3f30d3
children f358ea7a6377
files ChangeLog rust-launcher/src/main.rs
diffstat 2 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 14 09:48:26 2019 +0100
+++ b/ChangeLog	Mon Jan 14 09:54:38 2019 +0100
@@ -1,3 +1,10 @@
+2019-01-14  Jiri Vanek <jvanek@redhat.com>
+
+	Added support for -J options
+	* rust-launcher/src/main.rs: arguments are now copied to sub-process in two steps
+	First those with -J prefix are having it stripped and are given to JVM. Those withou J are
+	suffixed to the itw itself
+
 2019-01-14  Jiri Vanek <jvanek@redhat.com>
 
 	Added code-coverage for rust launchers
--- a/rust-launcher/src/main.rs	Mon Jan 14 09:48:26 2019 +0100
+++ b/rust-launcher/src/main.rs	Mon Jan 14 09:54:38 2019 +0100
@@ -101,7 +101,22 @@
     bin_name.push_str(&current_name);
     bin_location.push_str(&dirs_paths_helper::path_to_string(&current_bin));
 
+    let a = env::args();
+    let s = a.skip(1);
+    let c: std::vec::Vec<String> = s.collect();
+
     let mut all_args = std::vec::Vec::new();
+    for f in c.iter() {
+        if f.to_string().starts_with("-J") {
+            let s = String::from(f.to_string().get(2..).expect("-J should be substring-able by 2"));
+            if s.is_empty() {
+                os.info("Warning, empty -J switch")
+            } else {
+                all_args.push(s);
+            }
+        }
+    }
+
     all_args.push(bootcp);
     all_args.push(String::from("-classpath"));
     all_args.push(cp);
@@ -109,12 +124,10 @@
     all_args.push(bin_location);
     all_args.push(hardcoded_paths::get_main().to_string());
 
-
-    let a = env::args();
-    let s = a.skip(1);
-    let c: std::vec::Vec<String> = s.collect();
     for f in c.iter() {
-        all_args.push(f.to_string());
+        if !f.to_string().starts_with("-J") {
+            all_args.push(f.to_string());
+        }
     }
 
     let mut child = os.spawn_java_process(&java_dir, &all_args);