[libcxx-commits] [PATCH] D84096: [libcxx][lit] Simplify parsing of trailing executor arguments

Alexander Richardson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 21 01:04:29 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3980e8956b68: [libcxx][lit] Simplify parsing of trailing executor arguments (authored by arichardson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84096/new/

https://reviews.llvm.org/D84096

Files:
  libcxx/utils/run.py
  libcxx/utils/ssh.py


Index: libcxx/utils/ssh.py
===================================================================
--- libcxx/utils/ssh.py
+++ libcxx/utils/ssh.py
@@ -29,13 +29,9 @@
     parser.add_argument('--execdir', type=str, required=True)
     parser.add_argument('--codesign_identity', type=str, required=False, default=None)
     parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
-    (args, remaining) = parser.parse_known_args(sys.argv[1:])
-
-    if len(remaining) < 2:
-        sys.stderr.write('Missing actual commands to run')
-        return 1
-
-    commandLine = remaining[1:] # Skip the '--'
+    parser.add_argument("command", nargs=argparse.ONE_OR_MORE)
+    args = parser.parse_args()
+    commandLine = args.command
 
     ssh = lambda command: ['ssh', '-oBatchMode=yes', args.host, command]
     scp = lambda src, dst: ['scp', '-q', '-oBatchMode=yes', src, '{}:{}'.format(args.host, dst)]
Index: libcxx/utils/run.py
===================================================================
--- libcxx/utils/run.py
+++ libcxx/utils/run.py
@@ -23,12 +23,9 @@
     parser.add_argument('--execdir', type=str, required=True)
     parser.add_argument('--codesign_identity', type=str, required=False, default=None)
     parser.add_argument('--env', type=str, nargs='*', required=False, default=dict())
-    (args, remaining) = parser.parse_known_args(sys.argv[1:])
-
-    if len(remaining) < 2:
-        sys.stderr.write('Missing actual commands to run')
-        exit(1)
-    commandLine = remaining[1:] # Skip the '--'
+    parser.add_argument("command", nargs=argparse.ONE_OR_MORE)
+    args = parser.parse_args()
+    commandLine = args.command
 
     # Do any necessary codesigning.
     if args.codesign_identity:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84096.279440.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200721/3a694ecc/attachment.bin>


More information about the libcxx-commits mailing list