Show More
@@ -177,6 +177,16 b' def get_home_dir():' | |||||
177 | try: |
|
177 | try: | |
178 | homedir = env['HOME'] |
|
178 | homedir = env['HOME'] | |
179 | except KeyError: |
|
179 | except KeyError: | |
|
180 | # Last-ditch attempt at finding a suitable $HOME, on systems where | |||
|
181 | # it may not be defined in the environment but the system shell | |||
|
182 | # still knows it - reported once as: | |||
|
183 | # https://github.com/ipython/ipython/issues/154 | |||
|
184 | from subprocess import Popen, PIPE | |||
|
185 | homedir = Popen('echo $HOME', shell=True, | |||
|
186 | stdout=PIPE).communicate()[0].strip() | |||
|
187 | if homedir: | |||
|
188 | return homedir.decode(sys.getfilesystemencoding()) | |||
|
189 | else: | |||
180 | raise HomeDirError('Undefined $HOME, IPython cannot proceed.') |
|
190 | raise HomeDirError('Undefined $HOME, IPython cannot proceed.') | |
181 | else: |
|
191 | else: | |
182 | return homedir.decode(sys.getfilesystemencoding()) |
|
192 | return homedir.decode(sys.getfilesystemencoding()) |
@@ -194,6 +194,7 b' def test_get_home_dir_7():' | |||||
194 | home_dir = path.get_home_dir() |
|
194 | home_dir = path.get_home_dir() | |
195 | nt.assert_equal(home_dir, abspath(HOME_TEST_DIR)) |
|
195 | nt.assert_equal(home_dir, abspath(HOME_TEST_DIR)) | |
196 |
|
196 | |||
|
197 | ||||
197 | # Should we stub wreg fully so we can run the test on all platforms? |
|
198 | # Should we stub wreg fully so we can run the test on all platforms? | |
198 | @skip_if_not_win32 |
|
199 | @skip_if_not_win32 | |
199 | @with_environment |
|
200 | @with_environment |
General Comments 0
You need to be logged in to leave comments.
Login now