From fb653b65e5692bc42869a2a13b74e6ef785f4a23 Mon Sep 17 00:00:00 2001 From: "pgervais@chromium.org" Date: Tue, 29 Apr 2014 17:29:18 +0000 Subject: [PATCH] More explicit error message When running an executable fails, the original error message sent by the OS is printed, together with a more detailed suggested solution. BUG= Review URL: https://codereview.chromium.org/245133003 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@266908 0039d316-1c4b-4281-b951-d872f2087c98 --- subprocess2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subprocess2.py b/subprocess2.py index 3beeaeb58..9f547a63b 100644 --- a/subprocess2.py +++ b/subprocess2.py @@ -248,8 +248,9 @@ class Popen(subprocess.Popen): 'to learn how to fix this error; you need to rebase your cygwin ' 'dlls') # Popen() can throw OSError when cwd or args[0] doesn't exist. - raise OSError('%s or %s probably doesn\'t exist' % - (kwargs.get('cwd'), args[0])) + raise OSError('Execution failed with error: %s.\n' + 'Check that %s or %s exist and have execution permission.' + % (str(e), kwargs.get('cwd'), args[0])) def _tee_threads(self, input): # pylint: disable=W0622 """Does I/O for a process's pipes using threads.