Commits

Anonymous committed c0f05f3

tortoisehgtools: show system error message when command execution fails

Also do not crash when the command contains non ASCII characters.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

         # Otherwise, run the selected command in the brackground
         try:
             res = subprocess.Popen(command, cwd=self.repo.root)
-        except OSError:
+        except OSError, ex:
             res = 1
             qtlib.ErrorMsgBox(_('Failed to execute custom command'),
-                _('The command "%s" could not be executed.') % command,
-                _('Please check that its path is valid and '
-                  'that it is a valid application'))
+                _('The command "%s" could not be executed.') % hglib.tounicode(command),
+                _('The following error message was returned:\n\n"%s"\n\n'
+                'Please check that the command path is valid and '
+                'that it is a valid application') % hglib.tounicode(ex.strerror))
         return res
 
     def runCommand(self, *cmdlines):