diff --git a/tmuxp/session.py b/tmuxp/session.py index b4ef7a3731..558be22b47 100644 --- a/tmuxp/session.py +++ b/tmuxp/session.py @@ -9,7 +9,6 @@ with_statement, unicode_literals import os -import pipes import logging from .window import Window @@ -108,7 +107,6 @@ def rename_session(self, new_name): :rtype: :class:`Session` """ - new_name = pipes.quote(new_name) proc = self.tmux( 'rename-session', '-t%s' % self.get('session_id'), @@ -164,7 +162,6 @@ def new_window(self, if start_directory: # as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c. start_directory = os.path.expanduser(start_directory) - start_directory = pipes.quote(start_directory) window_args += ('-c%s' % start_directory,) window_args += ( diff --git a/tmuxp/testsuite/helpers.py b/tmuxp/testsuite/helpers.py index d51d1139fe..8d7004fefe 100644 --- a/tmuxp/testsuite/helpers.py +++ b/tmuxp/testsuite/helpers.py @@ -20,7 +20,7 @@ logger = logging.getLogger(__name__) -TEST_SESSION_PREFIX = 'tmuxp_' +TEST_SESSION_PREFIX = 'test tmuxp_' def get_test_session_name(server, prefix='tmuxp_'): diff --git a/tmuxp/testsuite/workspacebuilder.py b/tmuxp/testsuite/workspacebuilder.py index d980bbcbe2..4e73064cf1 100644 --- a/tmuxp/testsuite/workspacebuilder.py +++ b/tmuxp/testsuite/workspacebuilder.py @@ -384,6 +384,16 @@ class StartDirectoryTest(TmuxTestCase): - echo "hey" - shell_command: - echo "moo" + - window_name: cwd containing a space + start_directory: /tmp/foo bar + layout: main-horizontal + panes: + - shell_command: + - pwd + - shell_command: + - echo "hey" + - shell_command: + - echo "moo" - window_name: testsa3 layout: main-horizontal panes: @@ -405,6 +415,19 @@ class StartDirectoryTest(TmuxTestCase): - echo "moo3" """ + def setUp(self): + super(StartDirectoryTest, self).setUp() + if not os.path.exists('/tmp/foo bar'): + os.mkdir('/tmp/foo bar') + self._temp_dir_created = True + else: + self._temp_dir_created = False + + def tearDown(self): + super(StartDirectoryTest, self).tearDown() + if self._temp_dir_created: + os.rmdir('/tmp/foo bar') + def test_start_directory(self): sconfig = kaptan.Kaptan(handler='yaml') @@ -416,10 +439,10 @@ def test_start_directory(self): builder.build(session=self.session) assert(self.session == builder.session) - for path in ['/usr/bin', '/dev/', '/usr/', os.getcwd()]: - for window in self.session.windows: - for p in window.panes: - self.assertTrue(p.get('pane_start_path', path)) + dirs = ['/usr/bin', '/dev', '/tmp/foo bar', '/usr', os.getcwd()] + for path, window in zip(dirs, self.session.windows): + for p in window.panes: + self.assertEqual(p.get('pane_current_path'), path) class PaneOrderingTest(TmuxTestCase): diff --git a/tmuxp/window.py b/tmuxp/window.py index 93439d6edd..dc55f8fcd0 100644 --- a/tmuxp/window.py +++ b/tmuxp/window.py @@ -9,7 +9,6 @@ with_statement, unicode_literals import os -import pipes import logging from . import util, formats, exc @@ -378,7 +377,6 @@ def split_window( if start_directory: # as of 2014-02-08 tmux 1.9-dev doesn't expand ~ in new-window -c. start_directory = os.path.expanduser(start_directory) - start_directory = pipes.quote(start_directory) tmux_args += ('-c%s' % start_directory,) if not attach: