Skip to content

Commit 89fb342

Browse files
Make sure package names don't contain unprintable chars (#31)
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
1 parent e4d8e2a commit 89fb342

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ros_github_scripts/ci_for_pr.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,13 @@ def parse_args():
367367
# Create a group for these so that they are displayed below the 'change selection' group
368368
group = parser.add_argument_group(title='other options')
369369
group.add_argument('-h', '--help', action='help')
370+
def printable_package_name(value):
371+
if not value.isprintable():
372+
raise argparse.ArgumentTypeError(
373+
f'package name contains unprintable characters: {value!r}')
374+
return value
370375
group.add_argument(
371-
'-k', '--packages', type=str, nargs='+', default=None,
376+
'-k', '--packages', type=printable_package_name, nargs='+', default=None,
372377
help='Space-separated list of packages to be built and tested.')
373378
group.add_argument(
374379
'-t', '--target', type=str, default=DEFAULT_TARGET,

0 commit comments

Comments
 (0)