multiCMD 1.20__py3-none-any.whl → 1.22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiCMD
3
- Version: 1.20
3
+ Version: 1.22
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -0,0 +1,6 @@
1
+ multiCMD.py,sha256=6zXPE_EE45prV9Ew8HLfLVuzcst6NvucAYh1y9BgLLM,17192
2
+ multiCMD-1.22.dist-info/METADATA,sha256=ZWidoCtu7VnH_inX0g7kxjCLCCN5wHJFj_nzeOlxwcA,5640
3
+ multiCMD-1.22.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
4
+ multiCMD-1.22.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
5
+ multiCMD-1.22.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
6
+ multiCMD-1.22.dist-info/RECORD,,
multiCMD.py CHANGED
@@ -1,4 +1,10 @@
1
1
  #!/usr/bin/env python3
2
+ # /// script
3
+ # requires-python = ">=3.6"
4
+ # dependencies = [
5
+ # "argparse",
6
+ # ]
7
+ # ///
2
8
  import time
3
9
  import threading
4
10
  import io
@@ -12,7 +18,7 @@ import re
12
18
  import itertools
13
19
  import signal
14
20
 
15
- version = '1.20'
21
+ version = '1.22'
16
22
  __version__ = version
17
23
 
18
24
  __running_threads = []
@@ -233,14 +239,21 @@ def __run_command(task,sem, timeout=60, quiet=False,dry_run=False,with_stdErr=Fa
233
239
  task.returncode = 137
234
240
  else:
235
241
  task.returncode = -1
236
- if not quiet:
237
- print(pre+'\n'+ '-'*100+post)
238
- print(pre+f'Process exited with return code {task.returncode}'+post)
242
+ # if file not found
243
+ except FileNotFoundError as e:
244
+ print(f'Command / path not found: {task.command[0]}',file=sys.stderr,flush=True)
245
+ task.stderr.append(str(e))
246
+ task.returncode = 127
239
247
  except Exception as e:
240
248
  import traceback
249
+ print(f'Error running command: {task.command}',file=sys.stderr,flush=True)
250
+ print(str(e).split('\n'))
241
251
  task.stderr.extend(str(e).split('\n'))
242
252
  task.stderr.extend(traceback.format_exc().split('\n'))
243
253
  task.returncode = -1
254
+ if not quiet:
255
+ print(pre+'\n'+ '-'*100+post)
256
+ print(pre+f'Process exited with return code {task.returncode}'+post)
244
257
  if with_stdErr:
245
258
  return task.stdout + task.stderr
246
259
  else:
@@ -514,7 +527,7 @@ def main():
514
527
  parser.add_argument('-q','--quiet', action='store_true',help='quiet mode')
515
528
  parser.add_argument('-V','--version', action='version', version=f'%(prog)s {version} by pan@zopyr.us')
516
529
  args = parser.parse_args()
517
- run_commands(args.commands, args.timeout, args.max_threads, args.quiet,parse = args.parse)
530
+ run_commands(args.commands, args.timeout, args.max_threads, args.quiet,parse = args.parse, with_stdErr=True)
518
531
 
519
532
  if __name__ == '__main__':
520
533
  main()
@@ -1,6 +0,0 @@
1
- multiCMD.py,sha256=5OOmn_3szuEQp4RVS9nDDeEL9cfzQzSLRDJ_qIM0_tw,16788
2
- multiCMD-1.20.dist-info/METADATA,sha256=-8Yhw0mFiNK6-YiJocXtWV9ANLHGGdSGwoU6XLtRXdw,5640
3
- multiCMD-1.20.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
4
- multiCMD-1.20.dist-info/entry_points.txt,sha256=nSLBkYrcUCQxt1w3LIJkvgOhpRYEC0xAPqNG7u4OYs8,89
5
- multiCMD-1.20.dist-info/top_level.txt,sha256=DSqgftD40G09F3qEjpHRCUNUsGUvGZZG69Sm3YEUiWI,9
6
- multiCMD-1.20.dist-info/RECORD,,