summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Aaron Murphy <mmstickman@gmail.com>2017-01-17 21:35:10 -0500
committerMichael Aaron Murphy <mmstickman@gmail.com>2017-01-17 21:38:11 -0500
commit28f1bdb1c84a0b7f1edb85aca43fe99392053526 (patch)
tree9ff91ee431fa8fd00ed9e81504b8d722cc54c6bb
parent776dbca3fd98c393bf51d4e3f268815b15ff8ac7 (diff)
0.10.5: UTF-8 Tokenizer Fix0.10.5
-rw-r--r--Cargo.lock18
-rw-r--r--Cargo.toml4
-rw-r--r--README.md4
-rw-r--r--src/arguments/mod.rs4
-rw-r--r--src/execute/receive.rs2
-rw-r--r--src/tokenizer/mod.rs4
6 files changed, 19 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8cf0fcc..897e4da 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,11 +1,11 @@
[root]
name = "parallel"
-version = "0.10.4"
+version = "0.10.5"
dependencies = [
"arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "numtoa 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "numtoa 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"permutate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"sys-info 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -43,7 +43,7 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.19"
+version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -59,12 +59,12 @@ name = "num_cpus"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "numtoa"
-version = "0.0.3"
+version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -101,7 +101,7 @@ version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -111,7 +111,7 @@ name = "wait-timeout"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -129,10 +129,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)" = "3689e1982a563af74960ae3a4758aa632bb8fd984cfc3cc3b60ee6109477ab6e"
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
-"checksum libc 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9e030dc72013ed68994d1b2cbf36a94dd0e58418ba949c4b0db7eeb70a7a6352"
+"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5"
"checksum nodrop 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0dbbadd3f4c98dea0bd3d9b4be4c0cdaf1ab57035cb2e41fce3983db5add7cc5"
"checksum num_cpus 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a225d1e2717567599c24f88e49f00856c6e825a12125181ee42c4257e3688d39"
-"checksum numtoa 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "45c4d44bd57b868697b32b4445d06f96b9e4aa6389cf029c23f0b5216c6b2ffb"
+"checksum numtoa 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c9b7b224c1046b7264e7733b97037b61e98e59d34aac7f497c80c2061e63ddb8"
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba"
"checksum permutate 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b4ba980af238a6d6fcc0df53fe0d7920376bc4ce2c6ce298992891a230b47a8"
"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"
diff --git a/Cargo.toml b/Cargo.toml
index 6a90787..cfada1d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "parallel"
-version = "0.10.4"
+version = "0.10.5"
authors = ["Michael Aaron Murphy <mmstickman@gmail.com>"]
license = "MIT"
description = "Command-line CPU load balancer for executing jobs in parallel"
@@ -10,7 +10,7 @@ readme = "README.md"
[dependencies]
itoa = "0.1"
-numtoa = "0.0.3"
+numtoa = "0.0.5"
num_cpus = "1.2"
permutate = "0.2"
arrayvec = "0.3"
diff --git a/README.md b/README.md
index f7eb4ba..944aa29 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# MIT/Rust Parallel: A Command-line CPU Load Balancer Written in Rust
-[![Crates.io](https://img.shields.io/crates/v/parallel.svg)](https://github.com/mmstick/parallel)
+[![Crates.io](https://img.shields.io/crates/v/parallel.svg)](https://crates.io/crates/parallel)
[![Tokei SLoC Count](https://tokei.rs/b1/github/mmstick/parallel)](https://github.com/mmstick/parallel)
-[![AUR](https://img.shields.io/aur/version/parallel-rust.svg)](https://github.com/mmstick/parallel)
+[![AUR](https://img.shields.io/aur/version/parallel-rust.svg)](https://aur.archlinux.org/packages/parallel-rust/)
[![OpenHub Statistics](https://www.openhub.net/p/rust-parallel/widgets/project_thin_badge?format=gif&ref=Thin+badge)](https://www.openhub.net/p/rust-parallel/)
This is an attempt at recreating the functionality of [GNU Parallel](https://www.gnu.org/software/parallel/), a work-stealer for the command-line, in Rust under a MIT license. The end goal will be to support much of the functionality of `GNU Parallel` and then to extend the functionality further for the next generation of command-line utilities written in Rust. While functionality is important, with the application being developed in Rust, the goal is to also be as fast and efficient as possible.
diff --git a/src/arguments/mod.rs b/src/arguments/mod.rs
index e3f05a0..e77832d 100644
--- a/src/arguments/mod.rs
+++ b/src/arguments/mod.rs
@@ -263,7 +263,7 @@ impl Args {
fn write_stdin_to_disk(max_args: usize, mut unprocessed_path: PathBuf) -> Result<usize, ParseErr> {
println!("parallel: reading inputs from standard input");
unprocessed_path.push("unprocessed");
- let disk_buffer = fs::OpenOptions::new().write(true).create(true).open(&unprocessed_path)
+ let disk_buffer = fs::OpenOptions::new().truncate(true).write(true).create(true).open(&unprocessed_path)
.map_err(|why| ParseErr::File(FileErr::Open(unprocessed_path.clone(), why)))?;
let mut disk_buffer = BufWriter::new(disk_buffer);
let mut number_of_arguments = 0;
@@ -314,7 +314,7 @@ fn write_inputs_to_disk(lists: Vec<Vec<String>>, current_inputs: Vec<String>, ma
mut unprocessed_path: PathBuf) -> Result<usize, ParseErr>
{
unprocessed_path.push("unprocessed");
- let disk_buffer = fs::OpenOptions::new().write(true).create(true).open(&unprocessed_path)
+ let disk_buffer = fs::OpenOptions::new().truncate(true).write(true).create(true).open(&unprocessed_path)
.map_err(|why| ParseErr::File(FileErr::Open(unprocessed_path.to_owned(), why)))?;
let mut disk_buffer = BufWriter::new(disk_buffer);
let mut number_of_arguments = 0;
diff --git a/src/execute/receive.rs b/src/execute/receive.rs
index 1bdf84e..e1ae59c 100644
--- a/src/execute/receive.rs
+++ b/src/execute/receive.rs
@@ -93,7 +93,7 @@ pub fn receive_messages(input_rx: Receiver<State>, args: Args, base: &str, proce
let processed_file = fs::OpenOptions::new().create(true).write(true).open(processed_path).unwrap();
let mut processed_file = BufWriter::new(processed_file);
// An opened disk buffer pointing to the error file.
- let error_file = fs::OpenOptions::new().create(true).write(true).open(errors_path).unwrap();
+ let error_file = fs::OpenOptions::new().truncate(true).create(true).write(true).open(errors_path).unwrap();
let mut error_file = BufWriter::new(error_file);
// Obtaining the number of digits in the total number of inputs is required for padding purposes.
let mut id_pad_length = args.ninputs.digits();
diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs
index 3b86a4b..a7950ad 100644
--- a/src/tokenizer/mod.rs
+++ b/src/tokenizer/mod.rs
@@ -87,7 +87,8 @@ pub fn tokenize(tokens: &mut ArrayVec<[Token; 128]>, template: &'static str, pat
// Mark the index where the argument's first character begins.
let mut argument_start = 0;
- for (id, character) in template.chars().enumerate() {
+ let mut id = 0;
+ for character in template.chars() {
match (character, pattern_matching) {
// This condition initiates the pattern matching
('{', false) => {
@@ -126,6 +127,7 @@ pub fn tokenize(tokens: &mut ArrayVec<[Token; 128]>, template: &'static str, pat
},
(_, _) => ()
}
+ id += character.len_utf8();
}
// In the event that there is leftover data that was not matched, this will add the final