Commit graph

32 commits

Author SHA1 Message Date
André Klausnitzer
5cb26902e9
fix invalid syntax for os.path.join(... 2018-07-30 19:54:34 +02:00
Oliver Blanthorn
24a568d5d7
Fix wrong directory 2018-07-30 17:57:08 +01:00
Oliver Blanthorn
dd94e5a493
Fix #671: support _ prefix for RC, improve docs 2018-07-30 17:56:05 +01:00
Jeff King
fb0bfc0807 native: feed stdin of subprocess for "run"
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.
2018-07-18 01:18:13 -04:00
Jeff King
a9fb9b65e9 native: use os.join instead of backslashes for debug path
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.
2018-07-18 01:03:12 -04:00
Babil Golam Sarwar
75f21da384 Add consistent Python formatting 2018-05-29 12:08:08 +10:00
Babil Golam Sarwar
47d247aff7 Fix restart on Windows without needing Firefox on %PATH% 2018-05-28 00:32:30 +10:00
Babil Golam Sarwar
9d5ce40505 Remove -ProfileManager and -new-tab during Firefox restart 2018-05-27 10:19:26 +10:00
Babil Golam Sarwar
93ca6c50a6 Fix :restart under restricted PowerShell 2018-05-26 10:18:23 +10:00
Babil Golam Sarwar
d81f503259 Use -new-tab to activate Tridactyl on restart 2018-05-25 14:06:29 +10:00
Babil Golam Sarwar
00baee326f Fix "parent.lock" path and Firefox restart params 2018-05-24 17:23:59 +10:00
Babil Golam Sarwar
66444af20a Refactor and clean-up Python codes 2018-05-24 13:06:41 +10:00
Babil Golam Sarwar
fdc6f77b65 Merge branch 'master' into gsbabil/fix-restart-command-on-windows 2018-05-23 18:59:32 +10:00
Babil Golam Sarwar
c30327f73e Fix :restart command on Windows 2018-05-23 18:08:47 +10:00
Oliver Blanthorn
cb349b477e
Bump native version 2018-05-17 17:34:02 +01:00
Michal Koutný
98df8fff8e
Fix native_main 'temp' command for python < 3.5.0
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
2018-05-17 17:33:36 +01:00
Oliver Blanthorn
e5477283fd
Update changelog, bump native version 2018-05-15 22:58:52 +01:00
Lars Kellogg-Stedman
861110a76d provide hostname hint in editor temporary files
when calling an external editor, include the hostname of the remote
site in the generated temporary filename.

Closes #495
2018-05-11 13:33:40 -04:00
Lars Kellogg-Stedman
e23e972da4 native_main.py: close file desciptor returned by mkstemp
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.
2018-05-11 09:49:40 -04:00
Oliver Blanthorn
d428e2e9b0
Fix #513: Make Native.read understand ~ 2018-05-10 21:40:13 +01:00
Isaac Khor
5a7c786840
Add source for RC files, source_quiet at startup
Commit attributed to Isaac as he was instrumental to getting this in.
@bovine3dom added all of the bugs.
2018-05-10 21:38:52 +01:00
glacambre
afbbf3ee4c
native_{main.py,background.ts}: Add version check for getenv() 2018-05-10 13:01:30 +02:00
glacambre
b34397f315
native_{main.py,background}.ts: Add getenv() and ffargs() 2018-05-09 22:09:10 +02:00
Oliver Blanthorn
2f31ade76a
Support modifying userChrome even if user hasn't done it themselves first 2018-04-28 00:08:39 +01:00
Oliver Blanthorn
2231f5c422
Use system shell rather than python in exclaim 2018-04-26 12:33:01 +01:00
Oliver Blanthorn
e3cd80a91a
Catch errors with native run 2018-04-25 20:43:43 +01:00
Oliver Blanthorn
528c931971
Implement pipe support. 2018-04-25 20:43:42 +01:00
Oliver Blanthorn
3bbf2767f1
Generate the temporary file for $EDITOR in python
This should make multi-platform support easier and aid security (only
the user wot made the file can read it).
2018-04-25 20:43:42 +01:00
Oliver Blanthorn
adc91d6af2
Fix exclaim output 2018-04-25 20:43:42 +01:00
Colin Caine
ec13fa5dec
Native messenger code review 2018-04-25 20:43:41 +01:00
Oliver Blanthorn
5f68f9428d
Install native messenger on build; edit text in external editor
Currently we only support gVim and Linux, but `winword.exe` support is
theoretically possible.
2018-04-25 20:43:13 +01:00
John Beard
31958ed710
Merge johnnbeard's and IsaacKhor's native messenger
(Credited to John, merge by Olie)
2018-04-25 20:43:13 +01:00