tui: open log files in external application#6611
Conversation
3a22611 to
4eb3f7d
Compare
4eb3f7d to
853af33
Compare
| with tempfile.NamedTemporaryFile('w+') as temp_file: | ||
| # write the text into a temp file | ||
| temp_file.write(text) | ||
| temp_file.seek(0, 0) | ||
|
|
||
| # make the file readonly to avoid confusion | ||
| os.chmod(temp_file.name, stat.S_IRUSR) |
There was a problem hiding this comment.
This is the approach we used to use cylc view. Dump the text into a temp file and mark it as readonly so that people don't think they can edit it.
Note, we can't reliably edit the file locally because it might not be a local file.
853af33 to
f0695a9
Compare
|
For coverage, I think you could test this with a fake editor that just reads the file the in, then exits? |
f0695a9 to
c51d584
Compare
* Allow log files to be open in external applications. * Tui will suspend whilst the external tool is open, and resume once it has closed. * Options implemented are `$EDITOR`, `$GEDITOR`, `$PAGER` and `vim` as a backup.
c51d584 to
38b4c09
Compare
I've added an integration test that mocks out the command itself. This isn't really testing very much, but I think it's about all we can do without actually driving an interactive terminal session. |
Co-authored-by: Hilary James Oliver <hilary.j.oliver@gmail.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
hjoliver
left a comment
There was a problem hiding this comment.
All good (noting tests need updating now).
This comment was marked as resolved.
This comment was marked as resolved.
Dammit, I did update the tests, but CI has |
|
I tested with Gedit ( |
|
Works for me, use
|
…n_cylc_show * upstream/master: (27 commits) tui: open log files in external application (cylc#6611) fix typo in stop.py - options.max_poll -> options.max_polls schema: add first-parent descendants (cylc#6610) doc: improve NamespaceIDGlob description (cylc#6637) Document that "ex" prefix means "exclude" [skip ci] tests: remove string templating in SQL statements (cylc#6631) Merge pull request cylc#6629 from wxtim/tests.flake8 Remove vestiges of authorisation layer removed in cylc#3845 Bump dev version Prepare release 8.4.1 Merge pull request cylc#6578 from MetRonnie/graphql-err-handling Add test Update cylc/flow/etc/examples/expiry/index.rst Correct type annotations Fix duplicate task triggers Add test for duplicate task triggers Pytest: full verbosity for assertions Fix test picking up user global config Wrapper script: fix `PATH` override preventing selection of Cylc version in GUI under Cylc Hub Get poll to return task failure if job/log has been removed. (cylc#6577) ...
Requested in: https://cylc.discourse.group/t/feature-request-cylc-tui-searching-job-out-job-err-files/1122/2
$EDITOR,$GEDITOR,$PAGERandvimas a backup.Check List
CONTRIBUTING.mdand added my name as a Code Contributor.setup.cfg(andconda-environment.ymlif present).?.?.xbranch.