Handle FreeBSD's OSTYPE (which has "freebsdX.Y" format). While here,
convert OSTYPE check to use 'case' instead of if's/elif's.
For unknown OSTYPE fallback to the default Linux location.
There's currently no way to tell the native messenger to
provide a particular stdin to a "run" command. This leads to
awkward uses of here-docs, which in turn require hacks like
the one in 4a5dcd7557.
Instead, let's take the "content" field from the message
body and feed that to the command's stdin, which gives us a
more robust channel for passing arbitrary bytes.
Note that we have to switch to using subprocess.Popen's
communicate() method, which will make sure we don't deadlock
if the input or output exceeds a pipe buffer.
Note also that when no stdin is provided by the caller
(i.e., all current cases), we'll pass an empty string. This
actually fixes a minor bug. Because we didn't override the
command's stdin argument, it's hooked to the messenger's
stdin, which is the pipe coming from firefox. If the command
tries to read, it (and the messenger) will hang forever,
since firefox is waiting for the messenger to respond before
writing anything else.
I bumped the native messenger version. This is mostly
backwards compatible (existing callers just don't send any
stdin content at all). But a caller that wants to send stdin
should check to make sure we have at least 0.1.7.
This makes debugging work correctly on Linux. Otherwise
you'll generally get EPERM as `/home/user\.tridactyl` is a
path in `/home`, which you likely don't have access to
write.
This patch replaces the previous `-UsePython` flag with `-NoPython`.
Essentially this flag replaces the native messenger installation
behavior with the following new strategy on Windows:
* Look for Python-3 in user's Windows environment
- If Python-3 is found, install `native_main.py` as the native
messenger binary
- If Python-3 is _not_ found, install `native_main.exe` as the
native messenger binary
This commit adds support for comiling `native_main.py` into
`native_main.exe` using [PyInstaller][0].
By default, the Powershell installer script would use the compiled
EXE version for Windows. However, the old behaviour can achieved by
using the `-UsePython` flag to `win_install.ps1`.
Currently, the `native_main.exe` is built every time
`scripts/build.sh` is invoked. However, this behavior can be
adjusted by invoking the build script as shown below:
```
PYINSTALLER="0" npm run build
```
[0]: https://www.pyinstaller.org
We are passing None value to mkstemp which is only possible since python
3.5.0 [1]. Let's use our own mask with empty string as the prefix when
None is given. That works with both python API versions.
[1]
ad577b938b
Python's tempfile.mkstemp method returns an open file descriptor, but
native_main.py was ignoring that and re-opening the file. This commit
modifies the code to use os.fdopen so that the file descriptor is
closed when exiting the 'with ...' context manager.