Skip to content

Commit ae8c39e

Browse files
committed
Merge remote-tracking branch 'ThiefMaster/startdir-spaces' #73
2 parents 3a98705 + b006dfe commit ae8c39e

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

tmuxp/session.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
with_statement, unicode_literals
1010

1111
import os
12-
import pipes
1312
import logging
1413

1514
from .window import Window
@@ -108,7 +107,6 @@ def rename_session(self, new_name):
108107
:rtype: :class:`Session`
109108
110109
"""
111-
new_name = pipes.quote(new_name)
112110
proc = self.tmux(
113111
'rename-session',
114112
'-t%s' % self.get('session_id'),
@@ -164,7 +162,6 @@ def new_window(self,
164162
if start_directory:
165163
# as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c.
166164
start_directory = os.path.expanduser(start_directory)
167-
start_directory = pipes.quote(start_directory)
168165
window_args += ('-c%s' % start_directory,)
169166

170167
window_args += (

tmuxp/testsuite/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
logger = logging.getLogger(__name__)
2222

23-
TEST_SESSION_PREFIX = 'tmuxp_'
23+
TEST_SESSION_PREFIX = 'test tmuxp_'
2424

2525

2626
def get_test_session_name(server, prefix='tmuxp_'):

tmuxp/testsuite/workspacebuilder.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,16 @@ class StartDirectoryTest(TmuxTestCase):
387387
- echo "hey"
388388
- shell_command:
389389
- echo "moo"
390+
- window_name: cwd containing a space
391+
start_directory: /tmp/foo bar
392+
layout: main-horizontal
393+
panes:
394+
- shell_command:
395+
- pwd
396+
- shell_command:
397+
- echo "hey"
398+
- shell_command:
399+
- echo "moo"
390400
- window_name: testsa3
391401
layout: main-horizontal
392402
panes:
@@ -408,6 +418,19 @@ class StartDirectoryTest(TmuxTestCase):
408418
- echo "moo3"
409419
"""
410420

421+
def setUp(self):
422+
super(StartDirectoryTest, self).setUp()
423+
if not os.path.exists('/tmp/foo bar'):
424+
os.mkdir('/tmp/foo bar')
425+
self._temp_dir_created = True
426+
else:
427+
self._temp_dir_created = False
428+
429+
def tearDown(self):
430+
super(StartDirectoryTest, self).tearDown()
431+
if self._temp_dir_created:
432+
os.rmdir('/tmp/foo bar')
433+
411434
def test_start_directory(self):
412435

413436
sconfig = kaptan.Kaptan(handler='yaml')
@@ -419,10 +442,10 @@ def test_start_directory(self):
419442
builder.build(session=self.session)
420443

421444
assert(self.session == builder.session)
422-
for path in ['/usr/bin', '/dev/', '/usr/', os.getcwd()]:
423-
for window in self.session.windows:
424-
for p in window.panes:
425-
self.assertTrue(p.get('pane_start_path', path))
445+
dirs = ['/usr/bin', '/dev', '/tmp/foo bar', '/usr', os.getcwd()]
446+
for path, window in zip(dirs, self.session.windows):
447+
for p in window.panes:
448+
self.assertEqual(p.get('pane_current_path'), path)
426449

427450

428451
class PaneOrderingTest(TmuxTestCase):

tmuxp/window.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
with_statement, unicode_literals
1010

1111
import os
12-
import pipes
1312
import logging
1413

1514
from . import util, formats, exc
@@ -378,7 +377,6 @@ def split_window(
378377
if start_directory:
379378
# as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c.
380379
start_directory = os.path.expanduser(start_directory)
381-
start_directory = pipes.quote(start_directory)
382380
tmux_args += ('-c%s' % start_directory,)
383381

384382
if not attach:

0 commit comments

Comments
 (0)