Skip to content

Commit 1ba5bb7

Browse files
committed
Set LANG in spawnutils
1 parent 5ef80b2 commit 1ba5bb7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/spawnutils.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub fn exec_cmd(
2525
return Ok((Box::new(io::sink()), Box::new(io::empty()), "".to_string()));
2626
}
2727
let child = Command::new(&cmds[0])
28+
.env("LANG", "en_US.UTF-8")
2829
.args(&cmds[1..])
2930
.stdin(Stdio::piped())
3031
.stdout(Stdio::piped())
@@ -54,6 +55,7 @@ pub fn exec_cmd_sync_replace(input: String, cmds: &Vec<String>, line_end: u8, ch
5455
}
5556
}
5657
let child = Command::new(&cmds_new[0])
58+
.env("LANG", "en_US.UTF-8")
5759
.args(&cmds_new[1..])
5860
.stdout(Stdio::piped())
5961
.spawn()
@@ -79,6 +81,7 @@ pub fn exec_cmd_sync_replace(input: String, cmds: &Vec<String>, line_end: u8, ch
7981
pub fn exec_cmd_sync(input: String, cmds: &Vec<String>, line_end: u8, chomp: bool) -> String {
8082
debug!("thread: exec_cmd_sync: {:?}", &cmds);
8183
let mut child = Command::new(&cmds[0])
84+
.env("LANG", "en_US.UTF-8")
8285
.args(&cmds[1..])
8386
.stdin(Stdio::piped())
8487
.stdout(Stdio::piped())

tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,6 @@ mod cmdtest {
885885
fn test_csv_double_quotation_utf8() {
886886
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
887887
cmd.args(&["--csv", "-f", "2", "--", SED_CMD, "s/./@/g"])
888-
.env("LANG", "en_US.UTF-8")
889888
.write_stdin("名前,\"\"\"\",ノート\n1レコード目,\"\"\"いう\"\"\nえお\",かきく\n2レコード目,\"\"\"さしす\n\"\"せそ\",\"たちつ\nてと\"\n")
890889
.assert()
891890
.stdout("名前,@@@@@@,ノート\n1レコード目,@@@@@@@@\n@@@,かきく\n2レコード目,@@@@@@\n@@@@@,\"たちつ\nてと\"\n");

0 commit comments

Comments
 (0)