Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 15439:01611e7c36ff
dispatch: exit with 8-bit exit code
The exit code returned from a program to the shell is unsigned 8-bit, but
Mercurial would sometimes try to exit with negative numbers or None. sys.exit
on Unix will convert that to 8-bit exit codes, but on Windows negative values
showed up as 0.
The exit code is now explicitly converted to unsigned 8-bit.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 07 Nov 2011 03:14:53 +0100 |
parents | 81c97964d123 |
children | 646759147717 |
comparison
equal
deleted
inserted
replaced
15438:4d5b12a5517b | 15439:01611e7c36ff |
---|---|
22 self.fout = fout | 22 self.fout = fout |
23 self.ferr = ferr | 23 self.ferr = ferr |
24 | 24 |
25 def run(): | 25 def run(): |
26 "run the command in sys.argv" | 26 "run the command in sys.argv" |
27 sys.exit(dispatch(request(sys.argv[1:]))) | 27 sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) |
28 | 28 |
29 def dispatch(req): | 29 def dispatch(req): |
30 "run the command specified in req.args" | 30 "run the command specified in req.args" |
31 if req.ferr: | 31 if req.ferr: |
32 ferr = req.ferr | 32 ferr = req.ferr |