Added working_dir arg for tmux command sections
This commit is contained in:
parent
dc606a8780
commit
ca4234b1c3
2 changed files with 9 additions and 3 deletions
|
|
@ -654,7 +654,8 @@ def run_mprime_test(state):
|
||||||
run_program(['apple-fans', 'max'])
|
run_program(['apple-fans', 'max'])
|
||||||
tmux_update_pane(
|
tmux_update_pane(
|
||||||
state.panes['mprime'],
|
state.panes['mprime'],
|
||||||
command=['hw-diags-prime95', global_vars['TmpDir']])
|
command=['hw-diags-prime95', global_vars['TmpDir']],
|
||||||
|
working_dir=global_vars['TmpDir'])
|
||||||
time_limit = int(MPRIME_LIMIT) * 60
|
time_limit = int(MPRIME_LIMIT) * 60
|
||||||
try:
|
try:
|
||||||
for i in range(time_limit):
|
for i in range(time_limit):
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ def tmux_split_window(
|
||||||
lines=None, percent=None,
|
lines=None, percent=None,
|
||||||
behind=False, vertical=False,
|
behind=False, vertical=False,
|
||||||
follow=False, target_pane=None,
|
follow=False, target_pane=None,
|
||||||
command=None, text=None, watch=None):
|
working_dir=None, command=None,
|
||||||
|
text=None, watch=None):
|
||||||
"""Run tmux split-window command and return pane_id as str."""
|
"""Run tmux split-window command and return pane_id as str."""
|
||||||
# Bail early
|
# Bail early
|
||||||
if not lines and not percent:
|
if not lines and not percent:
|
||||||
|
|
@ -57,6 +58,8 @@ def tmux_split_window(
|
||||||
if target_pane:
|
if target_pane:
|
||||||
cmd.extend(['-t', str(target_pane)])
|
cmd.extend(['-t', str(target_pane)])
|
||||||
|
|
||||||
|
if working_dir:
|
||||||
|
cmd.extend(['-c', working_dir])
|
||||||
if command:
|
if command:
|
||||||
cmd.extend(command)
|
cmd.extend(command)
|
||||||
elif text:
|
elif text:
|
||||||
|
|
@ -71,13 +74,15 @@ def tmux_split_window(
|
||||||
result = run_program(cmd)
|
result = run_program(cmd)
|
||||||
return result.stdout.decode().strip()
|
return result.stdout.decode().strip()
|
||||||
|
|
||||||
def tmux_update_pane(pane_id, command=None, text=None):
|
def tmux_update_pane(pane_id, command=None, text=None, working_dir=None):
|
||||||
"""Respawn with either a new command or new text."""
|
"""Respawn with either a new command or new text."""
|
||||||
# Bail early
|
# Bail early
|
||||||
if not command and not text:
|
if not command and not text:
|
||||||
raise Exception('Neither command nor text specified.')
|
raise Exception('Neither command nor text specified.')
|
||||||
|
|
||||||
cmd = ['tmux', 'respawn-pane', '-k', '-t', pane_id]
|
cmd = ['tmux', 'respawn-pane', '-k', '-t', pane_id]
|
||||||
|
if working_dir:
|
||||||
|
cmd.extend(['-c', working_dir])
|
||||||
if command:
|
if command:
|
||||||
cmd.extend(command)
|
cmd.extend(command)
|
||||||
elif text:
|
elif text:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue