Closed strazto closed 3 years ago
I've pretty much implemented this, except that neither system
nor system2
are clever enough to know to syncronously wait for vd
to execute and return in a different tmux
pane, as now it is not waiting for vd
to return before continuing execution, and tmux split-window
, etc don't wait before return.
The result of this is that the temp file tends to be deleted before vd
can get to it.
If we omit file.remove(temp_file)
at the end of vd
, everything works correctly, but the file is not immediately cleaned up.
To me, this is not a huge issue, as the R session will still clean up temporary files automatically when it terminates, but you might disagree.
What are your thoughts?
Sounds really good. I'm an avid TMUX user myself, so this is a huge help. Merged the PR to master branch.
I get an error executing the shell script even though I'm already in a TMUX session. Will have to look into what's happening here.
/beegfs/scratch/bruening_scratch/pklemm/R/user_lib/rvisidata/tmux_pane.sh: line 5: tmux: command not found
Warning message:
In system2(vd_cmd, args = temp_file) : error in running command
Hm - funny What version of tmux are you running?
Not sure when split-window was added to tmux
I'm running tmux 2.6. But the error indicates that the script cannot locate tmux, which is odd. Will look into this when I have time.
Very odd, Maybe its a difference in where and when you source your environment?
If the bin dir that gives you tmux isn't added to PATH in a place that's sourced by R, maybe that could have something to do with it?
Its working on ubuntu, and on my work's Centos HPC env, though.
https://stackoverflow.com/questions/26065564/why-cant-i-call-system-functions-in-r-that-clearly-work-in-my-terminal SO thread describing a similar problem
IMO your best bet at a quick fix is to symlink /usr/bin/tmux to whatever which tmux
spits out
❯ which tmux
/usr/bin/tmux
Well, it's already installed to /usr/bin/tmux
. What a weird error.
Nevermind, I'm stupid. I'm running R on a HPC cluster using Singularity. R searches in /usr/bin of the Singularity container, not the actual host system. I guess I can fix that by adding tmux to my Singularity image.
Closed by #4
Hi, I use
tmux
a lot in my terminal workflows, and a nice tmux setup can really help the terminal feel more comfortable than an IDE.I wonder if you'd be interested in adding some optional tmux integration to this package?
Something along the lines of:
options(rvisidata.use_tmux)
is truevd
commandScripting tmux to perform a sequence of commands is not too hard.
I guess that script could go in
inst
, to provide a decent default tmux environment for viewing the data.There's not really a single "best" workspace for mixing between data exploration and interactive console use, so I imagine that in some instances it will be more useful to open
vd
in a new tmux window, etc.If that's the case, maybe allowing users to swap in their own scripts may helpful at some stage.
I'll fork and PR for now, and let me know what you think!