sapling/lib/hgpython
Jun Wu 58a0971e4e hgpython: use absolute path for Python argv[0]
Summary:
The `argv[0]` is used by libpython to decide the "executable path". However,
libpython cannot handle `argv[0]` being a relative path in the buck test
environment. Looking at the logic, it seems rather fragile. Therefore, use
the Rust stdlib to resolve the full path of the current executable. Pass
it as `argv[0]` to libpython, to make it able to insert the executable path
correctly.

This does affect `sys.argv[0]` seen from Python code. It is changed from a
relative path (ex.  `hg`) to a full path (ex. `/bin/hg`). It seems to be
more executable and therefore might avoid some surprises.

Reviewed By: markbt, xavierd

Differential Revision: D15989622

fbshipit-source-id: 5a0d5b2f3e0b9ca1d97c84cb72d5dc079e9d3c1b
2019-06-25 11:44:20 -07:00
..
src hgpython: use absolute path for Python argv[0] 2019-06-25 11:44:20 -07:00
Cargo.toml windows: switch to the new Python runtime 2019-06-24 08:34:23 -07:00