comparison mercurial/util.py @ 16383:f5dd179bfa4a

plan9: initial support for plan 9 from bell labs This patch contains support for Plan 9 from Bell Labs. A README is provided in contrib/plan9 which describes the port in greater detail. A new extension is also provided named factotum which permits the factotum(4) authentication agent to provide credentials for HTTP repositories. This extension is also applicable to other POSIX platforms which make use of Plan 9 from User Space (aka plan9ports).
author Steven Stallion <sstallion@gmail.com>
date Sun, 08 Apr 2012 12:43:41 -0700
parents e5788269741a
children f0f7f3fab315
comparison
equal deleted inserted replaced
16382:f542d291c4f2 16383:f5dd179bfa4a
420 if val is True: 420 if val is True:
421 return '1' 421 return '1'
422 return str(val) 422 return str(val)
423 origcmd = cmd 423 origcmd = cmd
424 cmd = quotecommand(cmd) 424 cmd = quotecommand(cmd)
425 env = dict(os.environ) 425 if sys.platform == 'plan9':
426 env.update((k, py2shell(v)) for k, v in environ.iteritems()) 426 # subprocess kludge to work around issues in half-baked Python
427 env['HG'] = hgexecutable() 427 # ports, notably bichued/python:
428 if out is None or out == sys.__stdout__: 428 if not cwd is None:
429 rc = subprocess.call(cmd, shell=True, close_fds=closefds, 429 os.chdir(cwd)
430 env=env, cwd=cwd) 430 rc = os.system(cmd)
431 else: 431 else:
432 proc = subprocess.Popen(cmd, shell=True, close_fds=closefds, 432 env = dict(os.environ)
433 env=env, cwd=cwd, stdout=subprocess.PIPE, 433 env.update((k, py2shell(v)) for k, v in environ.iteritems())
434 stderr=subprocess.STDOUT) 434 env['HG'] = hgexecutable()
435 for line in proc.stdout: 435 if out is None or out == sys.__stdout__:
436 out.write(line) 436 rc = subprocess.call(cmd, shell=True, close_fds=closefds,
437 proc.wait() 437 env=env, cwd=cwd)
438 rc = proc.returncode 438 else:
439 if sys.platform == 'OpenVMS' and rc & 1: 439 proc = subprocess.Popen(cmd, shell=True, close_fds=closefds,
440 rc = 0 440 env=env, cwd=cwd, stdout=subprocess.PIPE,
441 stderr=subprocess.STDOUT)
442 for line in proc.stdout:
443 out.write(line)
444 proc.wait()
445 rc = proc.returncode
446 if sys.platform == 'OpenVMS' and rc & 1:
447 rc = 0
441 if rc and onerr: 448 if rc and onerr:
442 errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]), 449 errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
443 explainexit(rc)[0]) 450 explainexit(rc)[0])
444 if errprefix: 451 if errprefix:
445 errmsg = '%s: %s' % (errprefix, errmsg) 452 errmsg = '%s: %s' % (errprefix, errmsg)