From 7758e0cf7bf8d898b2fa1ae3f6b7553740079a14 Mon Sep 17 00:00:00 2001 From: Daniel Thorn Date: Wed, 20 Nov 2024 08:49:01 -0800 Subject: [PATCH 1/2] pubsub-cli: strip whitespace when reading crashids from stdin --- obs_common/pubsub_cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/obs_common/pubsub_cli.py b/obs_common/pubsub_cli.py index f7018f0..a1a31ed 100755 --- a/obs_common/pubsub_cli.py +++ b/obs_common/pubsub_cli.py @@ -122,7 +122,11 @@ def publish(ctx, project_id, topic_name, crashids): # Pull crash ids from stdin if there are any if not crashids and not sys.stdin.isatty(): - crashids = list(click.get_text_stream("stdin").readlines()) + crashids = [ + line.strip() + for line in click.get_text_stream("stdin").readlines() + if line.strip() # ignore empty lines + ] if not crashids: raise click.BadParameter( From 1a299d216a495541e4297b1d61145ba7b8052a50 Mon Sep 17 00:00:00 2001 From: Daniel Thorn Date: Thu, 21 Nov 2024 08:34:59 -0800 Subject: [PATCH 2/2] Update pubsub_cli.py Co-authored-by: Sven Marnach --- obs_common/pubsub_cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obs_common/pubsub_cli.py b/obs_common/pubsub_cli.py index a1a31ed..1c78e8c 100755 --- a/obs_common/pubsub_cli.py +++ b/obs_common/pubsub_cli.py @@ -123,9 +123,9 @@ def publish(ctx, project_id, topic_name, crashids): # Pull crash ids from stdin if there are any if not crashids and not sys.stdin.isatty(): crashids = [ - line.strip() - for line in click.get_text_stream("stdin").readlines() - if line.strip() # ignore empty lines + stripped + for line in click.get_text_stream("stdin") + if (stripped := line.strip()) # ignore empty lines ] if not crashids: