diff --git a/confluent_client/bin/nodeconsole b/confluent_client/bin/nodeconsole index 658d2998..3b5afa51 100755 --- a/confluent_client/bin/nodeconsole +++ b/confluent_client/bin/nodeconsole @@ -39,7 +39,25 @@ argparser.add_option('-t', '--tile', action='store_true', default=False, argparser.add_option('-l', '--log', action='store_true', default=False, help='Enter log replay mode instead of showing a live console') argparser.add_option('-w','--windowed', action='store_true', default=False, - help='Open terminal windows for each node') + help='Open terminal windows for each node. The ' + 'environment variable NODECONSOLE_WINDOWED_COMMAND ' + 'should be set, which should be a text string corresponding ' + 'to a command that can be used to open a windowed console,' + ' omitting the "nodeconsole " part of the ' + 'command, for example, to open a set of consoles for a ' + 'range of nodes in separate xterm windows, set ' + 'NODECONSOLE_WINDOWED_COMMAND to "xterm -e". To open a ' + 'set of consoles for a range of nodes in separate ' + 'GNOME Terminal windows with a size of 100 columns and ' + '31 rows, set NODECONSOLE_WINDOWED_COMMAND ' + 'to "gnome-terminal --geometry 100x31 --" or in a WSL ' + 'environment, to open a set of consoles for a range of ' + 'nodes in separate Windows Terminal windows, with the ' + 'title set for each node, set NODECONSOLE_WINDOWED_COMMAND' + ' to "wt.exe wsl.exe -d AlmaLinux-8 ' + '--shell-type login". If the NODECONSOLE_WINDOWED_COMMAND ' + 'environment variable isn\'t set, xterm will be used by' + 'default.') (options, args) = argparser.parse_args() if len(args) != 1: argparser.print_help() @@ -56,6 +74,11 @@ if options.log: #added functionality for wcons if options.windowed: + envstring=os.environ.get('NODECONSOLE_WINDOWED_COMMAND') + if not envstring: + envlist=["xterm", "-e"] + else: + envlist=os.environ.get('NODECONSOLE_WINDOWED_COMMAND').split(' ') nodes = [] sess = client.Command() for res in sess.read('/noderange/{0}/nodes/'.format(args[0])): @@ -65,9 +88,9 @@ if options.windowed: sys.exit(1) nodes.append(node) for node in sortutil.natural_sort(nodes): - sub = subprocess.Popen(['xterm', '-e', 'nodeconsole', node]) + with open(os.devnull, 'wb') as devnull: + subprocess.Popen(envlist + [confettypath, '-m', '5', 'start', '/nodes/{0}/console/session'.format(node)], stdin=devnull) sys.exit(0) - #end of wcons if options.tile: null = open('/dev/null', 'w') diff --git a/confluent_client/doc/man/nodeconsole.ronn b/confluent_client/doc/man/nodeconsole.ronn index 286e14e1..c9246e7f 100644 --- a/confluent_client/doc/man/nodeconsole.ronn +++ b/confluent_client/doc/man/nodeconsole.ronn @@ -28,8 +28,24 @@ a new session. manager at this time. * `-w`, `--windowed`: - Openes separate xterm windows for each console in the node range provided. This - works for xterm only. + Open terminal windows for each node. The + environment variable **NODECONSOLE_WINDOWED_COMMAND** + should be set, which should be a text string corresponding + to a command that can be used to open a windowed console, + omitting the `nodeconsole ` part of the + command, for example, to open a set of consoles for a + range of nodes in separate xterm windows, set + **NODECONSOLE_WINDOWED_COMMAND** to `xterm -e`. To open a + set of consoles for a range of nodes in separate + GNOME Terminal windows with a size of 100 columns and + 31 rows, set **NODECONSOLE_WINDOWED_COMMAND** + to `gnome-terminal --geometry 100x31 --` or in a WSL + environment, to open a set of consoles for a range of + nodes in separate Windows Terminal windows, with the + title set for each node, set **NODECONSOLE_WINDOWED_COMMAND** + to `wt.exe wsl.exe -d AlmaLinux-8 --shell-type login. If the + NODECONSOLE_WINDOWED_COMMAND environment variable isn't set, + xterm will be used bydefault. ## ESCAPE SEQUENCE COMMANDS