Show More
@@ -177,7 +177,17 b' def get_home_dir():' | |||
|
177 | 177 | try: |
|
178 | 178 | homedir = env['HOME'] |
|
179 | 179 | except KeyError: |
|
180 | raise HomeDirError('Undefined $HOME, IPython cannot proceed.') | |
|
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: | |
|
190 | raise HomeDirError('Undefined $HOME, IPython cannot proceed.') | |
|
181 | 191 | else: |
|
182 | 192 | return homedir.decode(sys.getfilesystemencoding()) |
|
183 | 193 | elif os.name == 'nt': |
@@ -193,6 +193,7 b' def test_get_home_dir_7():' | |||
|
193 | 193 | env["HOMESHARE"] = abspath(HOME_TEST_DIR) |
|
194 | 194 | home_dir = path.get_home_dir() |
|
195 | 195 | nt.assert_equal(home_dir, abspath(HOME_TEST_DIR)) |
|
196 | ||
|
196 | 197 | |
|
197 | 198 | # Should we stub wreg fully so we can run the test on all platforms? |
|
198 | 199 | @skip_if_not_win32 |
General Comments 0
You need to be logged in to leave comments.
Login now