Add a specific "ps" command under Cygwin in coriolisEnv.py.
This commit is contained in:
parent
91e7685921
commit
b7f6af8588
|
@ -130,7 +130,7 @@ def guessOs ():
|
||||||
return ( osType, useDevtoolset )
|
return ( osType, useDevtoolset )
|
||||||
|
|
||||||
|
|
||||||
def guessShell ( forcedShell ):
|
def guessShell ( defaultShell, osType ):
|
||||||
"""
|
"""
|
||||||
Try to guess the kind shell we are running under, Bourne-like shells
|
Try to guess the kind shell we are running under, Bourne-like shells
|
||||||
(sh, bash, ksh, zsh) or C-shell likes (csh, tcsh).
|
(sh, bash, ksh, zsh) or C-shell likes (csh, tcsh).
|
||||||
|
@ -157,19 +157,26 @@ def guessShell ( forcedShell ):
|
||||||
, u'/usr/local/bin/csh'
|
, u'/usr/local/bin/csh'
|
||||||
]
|
]
|
||||||
if shellName is None:
|
if shellName is None:
|
||||||
|
psCommand = ['ps', '-o', 'comm', '-p', str(os.getppid()) ]
|
||||||
|
cmdField = 0
|
||||||
|
if osType.startswith('Cygwin'):
|
||||||
|
psCommand = ['ps', '-p', str(os.getppid()) ]
|
||||||
|
cmdField = 7
|
||||||
try:
|
try:
|
||||||
psResult = subprocess.run( ['ps', '-o', 'comm', '-p', str(os.getppid()) ]
|
psResult = subprocess.run( psCommand, capture_output=True, check=True )
|
||||||
, capture_output=True, check=True )
|
shell = psResult.stdout.splitlines()[1].decode('utf8').split()[cmdField].lstrip('-')
|
||||||
shell = psResult.stdout.splitlines()[1].decode('utf8').split()[0].lstrip('-')
|
if shell[0] != '/':
|
||||||
whichCommand = subprocess.run( ['which', shell ], capture_output=True, check=True )
|
whichCommand = subprocess.run( ['which', shell ], capture_output=True, check=True )
|
||||||
shellPath = whichCommand.stdout.splitlines()[0].decode('utf8')
|
shellPath = whichCommand.stdout.splitlines()[0].decode('utf8')
|
||||||
|
else:
|
||||||
|
shellPath = shell
|
||||||
|
print( 'echo "[GUESSED] shellPath={}";'.format(shellPath) )
|
||||||
except Exception:
|
except Exception:
|
||||||
shellPath = u'/bin/bash'
|
shellPath = u'/bin/bash'
|
||||||
print( 'echo "Shell *NOT* guessed, using {}";'.format(shellPath) )
|
print( 'echo "[ERROR] \\"ps\\" command failure, using {}";'.format(shellPath) )
|
||||||
print( 'echo "GUESSED shellPath={}";'.format(shellPath) )
|
|
||||||
else:
|
else:
|
||||||
shellPath = forcedShell
|
shellPath = defaultShell
|
||||||
#print( 'FORCED shellPath={}'.format(shellPath) )
|
print( 'echo "Defaulting to shell {}";'.format(shellPath) )
|
||||||
if shellPath in cshBins:
|
if shellPath in cshBins:
|
||||||
#print( 'Matched C-Shell' )
|
#print( 'Matched C-Shell' )
|
||||||
isBourneShell = False
|
isBourneShell = False
|
||||||
|
@ -206,7 +213,7 @@ if __name__ == "__main__":
|
||||||
if options.shared: linkType = "Shared"
|
if options.shared: linkType = "Shared"
|
||||||
if options.rootDir: rootDir = options.rootDir
|
if options.rootDir: rootDir = options.rootDir
|
||||||
if options.shell: shellName = options.shell
|
if options.shell: shellName = options.shell
|
||||||
shellBin, isBourneShell = guessShell( shellName )
|
shellBin, isBourneShell = guessShell( shellName, osType )
|
||||||
|
|
||||||
scriptPath = os.path.abspath( os.path.dirname( sys.argv[0] ))
|
scriptPath = os.path.abspath( os.path.dirname( sys.argv[0] ))
|
||||||
if 'Debug.' in scriptPath: buildType = 'Debug'
|
if 'Debug.' in scriptPath: buildType = 'Debug'
|
||||||
|
|
Loading…
Reference in New Issue