[merge request] Kubuntu Automation: exit nicer with non-existant commands with do-all

José Manuel Santamaría Lema panfaust at gmail.com
Sat Nov 12 13:51:55 UTC 2016


Hi,

El viernes, 11 de noviembre de 2016 16:37:05 (CET) Walter Lapchynski escribió:
> Currently, the `do-all` command accepts a required argument /command/ which
> is called without checking to see if the command is actually valid. To deal
> with this, we catch an OSError exception. Technically this, covers more
> than just a file not found issue FWIW. The exit code is actually
> specifically for a command not found, however.
> 
> Last commit here does the trick:
> https://code.launchpad.net/~wxl/+git/kubuntu-automation/+ref/master

I'm getting this with your patch:
user at host:~/kubuntu-dev/plasma$ do-all asdasddsfsdfs
----------------------------------------------------------------------
do-all current directory: kwayland-integration/git/ (1 of 42)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/santa/kubuntu-automation/do-all", line 69, in <module>
    returncode = subprocess.call(command)
  File "/usr/lib/python3.5/subprocess.py", line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'asdasddsfsdfs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/santa/kubuntu-automation/do-all", line 74, in <module>
    print("'%s' is not a valid command" % ' '.join(map(str,thing)))
NameError: name 'thing' is not defined






More information about the kubuntu-devel mailing list