Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug 829] Handing / Behaviour of command via -x option / prefs in te… #845

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions terminatorlib/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1558,9 +1558,13 @@ def spawn_child(self, widget=None, respawn=False, debugserver=False, init_comman
self.set_cwd(options.working_directory)
options.working_directory = ''

if type(command) is list:
if type(command) is list and len(command):
shell = util.path_lookup(command[0])
args = command
#skip first item already taken as shell
#should we check if shell is acutally a valid shell ?
command = ' '.join(command[1:])
dbg('command is list with: shell:%s args:%s command:%s'
% (shell, args, command))
else:
shell = util.shell_lookup()

Expand All @@ -1569,8 +1573,12 @@ def spawn_child(self, widget=None, respawn=False, debugserver=False, init_comman
else:
args.insert(0, shell)

if command is not None:
args += ['-c', command]
#if command is not None:
# args += ['-c', command]

#command str taken and fed in feed_child
dbg('command is NOT list with: shell:%s args:%s command:%s'
% (shell, args, command))

if shell is None:
self.vte.feed(_('Unable to find a shell'))
Expand All @@ -1589,7 +1597,8 @@ def spawn_child(self, widget=None, respawn=False, debugserver=False, init_comman
if self.terminator.dbus_path:
envv.append('TERMINATOR_DBUS_PATH=%s' % self.terminator.dbus_path)

dbg('Forking shell: "%s" with args: %s' % (shell, args))
dbg('Forking shell: "%s" with args: %s command:%s' %
(shell, args, command))
args.insert(0, shell)

if util.is_flatpak():
Expand Down Expand Up @@ -1622,6 +1631,8 @@ def spawn_child(self, widget=None, respawn=False, debugserver=False, init_comman
None
)

if command:
self.vte.feed_child((command+'\n').encode('utf-8'))
self.command = shell

self.titlebar.update()
Expand Down
Loading