virt-top: fix to parse init-file correctly
authorYuya Higashi <higashi.yuya@fujitsu.com>
Mon, 26 Dec 2022 00:18:15 +0000 (09:18 +0900)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 9 Jan 2023 12:06:10 +0000 (12:06 +0000)
commit1d04fdfce6edea685596fbb18920799c70f1d7fa
treeabdd3bd2843b7692b81c4f2f18431dfad9d25c00
parent4b15ee2440b0e70e3c1eb5e164ded493e2d8f0c8
virt-top: fix to parse init-file correctly

This fixes the following runtime error when parsing init-file.

$ virt-top --init-file <(echo "sort id")
Error: Invalid_argument("String.sub / Bytes.sub")
Raised at Stdlib.invalid_arg in file "stdlib.ml", line 30, characters 20-45
Called from Stdlib__String.sub in file "string.ml" (inlined), line 50, characters 2-23
Called from Utils.split in file "utils.ml", line 82, characters 24-68
Called from Utils.read_config_file.(fun) in file "utils.ml", line 114, characters 23-37
Called from Stdlib__List.map in file "list.ml", line 92, characters 20-23
Called from Top.start_up.try_to_read_init_file in file "top.ml", line 153, characters 17-42
Called from Main.script_mode in file "main.ml", line 37, characters 6-17

Signed-off-by: Yuya Higashi <higashi.yuya@fujitsu.com>
src/utils.ml