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

Walter Lapchynski wxl at ubuntu.com
Sat Nov 12 17:46:07 UTC 2016


See what happens when you try to make a quick commit right before going to
talk? Fixed with a wee s/thing/command/ (derp)

On Sat, Nov 12, 2016 at 5:51 AM, José Manuel Santamaría Lema <
panfaust at gmail.com> wrote:

> 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
>
>
>
>
> --
> kubuntu-devel mailing list
> kubuntu-devel at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/kubuntu-devel
>



-- 
       @wxl | polka.bike
C563 CAC5 8BE1 2F22 A49D
68F6 8B57 A48B C4F2 051A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-devel/attachments/20161112/3c45c4ee/attachment.html>


More information about the kubuntu-devel mailing list