@cached_property<EOL><INDENT>def shell(self):<DEDENT>
from rez.shells import get_shell_types<EOL>shells = set(get_shell_types())<EOL>if not shells:<EOL><INDENT>raise RezSystemError("<STR_LIT>")<EOL><DEDENT>if self.platform == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>import subprocess as sp<EOL>shell = None<EOL>try:<EOL><INDENT>args = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', str(os.getppid())]<EOL>proc = sp.Popen(args, stdout=sp.PIPE)<EOL>output = proc.communicate()[<NUM_LIT:0>]<EOL>shell = os.path.basename(output.strip().split()[<NUM_LIT:0>]).replace('<STR_LIT:->', '<STR_LIT>')<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT>if shell not in shells:<EOL><INDENT>shell = os.path.basename(os.getenv("<STR_LIT>", '<STR_LIT>'))<EOL><DEDENT>if shell not in shells:<EOL><INDENT>pid = str(os.getppid())<EOL>found = False<EOL>while not found:<EOL><INDENT>try:<EOL><INDENT>file = os.path.join(os.sep, "<STR_LIT>", pid, "<STR_LIT:status>")<EOL>with open(file) as f:<EOL><INDENT>loc = f.read().split('<STR_LIT:\n>')<EOL><DEDENT>for line in loc:<EOL><INDENT>line = line.strip()<EOL>toks = line.split()<EOL>if len(toks) == <NUM_LIT:2>:<EOL><INDENT>if toks[<NUM_LIT:0>] == "<STR_LIT>":<EOL><INDENT>name = toks[<NUM_LIT:1>]<EOL>if name in shells:<EOL><INDENT>shell = name<EOL>found = True<EOL>break<EOL><DEDENT><DEDENT>elif toks[<NUM_LIT:0>] == "<STR_LIT>":<EOL><INDENT>pid = toks[<NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except Exception:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>if (shell not in shells) and ("<STR_LIT>" in shells):<EOL><INDENT>shell = "<STR_LIT>"  <EOL><DEDENT>elif (shell not in shells) and ("<STR_LIT>" in shells):<EOL><INDENT>shell = "<STR_LIT>"  <EOL><DEDENT>elif shell not in shells:<EOL><INDENT>shell = iter(shells).next()  <EOL><DEDENT>if shell == "<STR_LIT>":<EOL><INDENT>if os.path.islink("<STR_LIT>"):<EOL><INDENT>path = os.readlink("<STR_LIT>")<EOL>shell2 = os.path.split(path)[-<NUM_LIT:1>]<EOL>if shell2 == "<STR_LIT>":<EOL><INDENT>pass<EOL><DEDENT>elif shell2 == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in shells:<EOL><INDENT>shell = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>if "<STR_LIT>" in shells:<EOL><INDENT>shell = "<STR_LIT>"  <EOL><DEDENT>else:<EOL><INDENT>shell = iter(shells).next()  <EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if shell == "<STR_LIT>":<EOL><INDENT>shell = "<STR_LIT>"<EOL><DEDENT>return shell<EOL><DEDENT>
Get the current shell.
        @returns The current shell this process is running in. Examples:

            bash
            tcsh