OSDN Git Service

simpletrace: improve parsing of sys.argv; fix files never closed.
authorMads Ynddal <m.ynddal@samsung.com>
Tue, 26 Sep 2023 10:34:25 +0000 (12:34 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 26 Sep 2023 16:28:51 +0000 (12:28 -0400)
commitf7bd4f0237ec394198940f5b81cbde280c5b5c01
tree140dc990e783df44579adbb1f710a9f305ee46fb
parent8405ec6ab6a05b8c84f7be1130a7891d1a874624
simpletrace: improve parsing of sys.argv; fix files never closed.

The arguments extracted from `sys.argv` named and unpacked to make it
clear what the arguments are and what they're used for.

The two input files were opened, but never explicitly closed. File usage
changed to use `with` statement to take care of this. At the same time,
ownership of the file-object is moved up to `run` function. Added option
to process to support file-like objects.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Mads Ynddal <m.ynddal@samsung.com>
Message-id: 20230926103436.25700-4-mads@ynddal.dk
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scripts/simpletrace.py