[issue2540] util.system fails using commands with spaces on windows

Antonio Cavallo bugs at mercurial.selenic.com
Wed Dec 8 13:22:45 UTC 2010


New submission from Antonio Cavallo <a.cavallo at mailsnare.com>:

The file util.py contains a system function:

-------------------------------------
def system(cmd, environ={}, cwd=None, onerr=None, errprefix=None, out=None):
    '''enhanced shell command execution.
.....
    origcmd = cmd
    if os.name == 'nt':
        cmd = '"%s"' % cmd
    env = dict(os.environ)
-------------------------------------

The if os.name == 'nt' test puts quotes on the original command line on
nt system: this will fail execution of extdiff extension.

The error message from this configuration:

[extensions]
extdiff =
 
[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /ro

Is:

'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.

The fix is to disable this wrapping.

Os. win XP pro sp3
Python. 2.7.1

----------
messages: 14600
nosy: cavallo71
priority: bug
status: unread
title: util.system fails using commands with spaces on windows

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2540>
____________________________________________________


More information about the Mercurial-devel mailing list