mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 04:05:30 -05:00
fix CCUnix.escape_str
This commit is contained in:
parent
6fb26288ad
commit
1da809c596
2 changed files with 3 additions and 3 deletions
|
|
@ -50,7 +50,7 @@ let rec iter_gen f g = match g() with
|
||||||
(* print a string, but escaped if required *)
|
(* print a string, but escaped if required *)
|
||||||
let escape_str buf s =
|
let escape_str buf s =
|
||||||
if str_exists s
|
if str_exists s
|
||||||
(function ' ' | '"' | '\'' -> true | _ -> false)
|
(function ' ' | '"' | '\'' | '\n' | '\t'-> true | _ -> false)
|
||||||
then (
|
then (
|
||||||
Buffer.add_char buf '\'';
|
Buffer.add_char buf '\'';
|
||||||
String.iter
|
String.iter
|
||||||
|
|
@ -79,7 +79,7 @@ let read_all ?(size=1024) ic =
|
||||||
with Exit ->
|
with Exit ->
|
||||||
Bytes.sub_string !buf 0 !len
|
Bytes.sub_string !buf 0 !len
|
||||||
|
|
||||||
type call_result =
|
type call_result =
|
||||||
< stdout:string;
|
< stdout:string;
|
||||||
stderr:string;
|
stderr:string;
|
||||||
status:Unix.process_status;
|
status:Unix.process_status;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ val escape_str : Buffer.t -> string -> unit
|
||||||
CCPrint.sprintf "%a" escape_str "fo'o b'ar" = "'fo''o b''ar'"
|
CCPrint.sprintf "%a" escape_str "fo'o b'ar" = "'fo''o b''ar'"
|
||||||
*)
|
*)
|
||||||
|
|
||||||
type call_result =
|
type call_result =
|
||||||
< stdout:string;
|
< stdout:string;
|
||||||
stderr:string;
|
stderr:string;
|
||||||
status:Unix.process_status;
|
status:Unix.process_status;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue