Changeset 585 in tailor


Ignore:
Timestamp:
08/16/05 00:42:40 (8 years ago)
Author:
lele@…
Hash name:
20050815224240-97f81-316f2e9aa2fe6f1c5af73609f25420d37d7a3ac8
Message:

Raise an OSError when an external command is not found

Location:
vcpx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vcpx/shwrap.py

    r571 r585  
    160160                            cwd=kwargs.get('cwd'), 
    161161                            universal_newlines=True) 
    162         except OSError: 
    163             stderr.write("'%s' does not exist!" % self._last_command[0]) 
    164             self.exit_status = -1 
    165             return 
     162        except OSError, e: 
     163            from errno import ENOENT 
     164 
     165            if e.errno == ENOENT: 
     166                raise OSError("'%s' does not exist!" % self._last_command[0]) 
     167            else: 
     168                raise 
    166169 
    167170        if input: 
  • vcpx/tests/shwrap.py

    r581 r585  
    3030 
    3131    def testExitStatusUnknownCommand(self): 
    32         """Verify ExternalCommand exit_status for non existing command. 
     32        """Verify ExternalCommand raise OSError for non existing command. 
    3333        """ 
    3434 
    3535        c = ExternalCommand(['/does/not/exist']) 
    36         c.execute() 
    37         self.assertNotEqual(c.exit_status, 0) 
     36        self.assertRaises(OSError, c.execute) 
    3837 
    3938    def testStandardOutput(self): 
Note: See TracChangeset for help on using the changeset viewer.