diff options
Diffstat (limited to 'b4/__init__.py')
-rw-r--r-- | b4/__init__.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 7e4295e..43fd078 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1956,20 +1956,19 @@ def get_msgid_from_stdin(): if not sys.stdin.isatty(): message = email.message_from_string(sys.stdin.read()) return message.get('Message-ID', None) - logger.error('Error: pipe a message or pass msgid as parameter') - sys.exit(1) + return None -def get_msgid(cmdargs): +def get_msgid(cmdargs) -> Optional[str]: if not cmdargs.msgid: logger.debug('Getting Message-ID from stdin') msgid = get_msgid_from_stdin() - if msgid is None: - logger.error('Unable to find a valid message-id in stdin.') - sys.exit(1) else: msgid = cmdargs.msgid + if msgid is None: + return None + msgid = msgid.strip('<>') # Handle the case when someone pastes a full URL to the message matches = re.search(r'^https?://[^/]+/([^/]+)/([^/]+@[^/]+)', msgid, re.IGNORECASE) |