> Why are you using status_replace() for this?  format_expand() and
> using a struct format_tree * makes much more sense here.  What has
> status_replace() got to do with expanding file names?

I want to allow things like #S and #P in the filename so people can
tell the different logs apart.  Using status_replace() allows me to do
that.  It also allows for using strftime() patterns in the filename in
case people want a timestamp in the logname.  I could implement that
using my own function which used strftime(), format_session(),
format_expand(), etc., but then I'd end up with a function that's very
similar to status_replace().  If you didn't like that
cmd_string_expand_path() was similar to cmd_string_parse(), then I
imagine you wouldn't like that, either.


> That doesn't sound right to me, and from what little testing I've done
> here I can't reproduce that.  But I certainly don't like the idea of
> another function which is "similar" to cmd_string_parse().


If you've applied my patch, then try this command:

logp -b -f  /tmp/tmux-#P.log

Notice there are no quotes.  You should see that your log file is
/tmp/tmux-  because the # and everything after it got cut off.

To see that a tilde doesn't get expanded when quoted, just do this:

pipe-pane "cat >> ~/tmux.log"

Now do a ps and grep for the sh process that tmux spawned (sh -c cat
...).  You should see that the tilde didn't get expanded, but things
still work because the shell interprets the tilde correctly.  If that
doesn't count because the tilde wasn't at the start of the string,
then do this:

ln -s /bin/cat ~/cat
pipe-pane "~/cat >> ~/tmux.log"


Again, a ps will show that the tildes didn't get expanded.  This isn't
a problem for pipe-pane because the shell interprets it, but for
log-pane there isn't an external shell process.  To see that a tilde
does get expanded if it isn't quoted, do this:

ln -s /bin/cat ~/cat
pipe-pane ~/"cat >> /tmp/tmux.log"

Now a ps will show that the tilde got expanded.  But it's unusual to
quote things in this way.

Also, cmd_string_parse() is only called if you explicitly run logp.
If you use the auto logging, then you'd have to build a temporary
command string and pass it to cmd_string_parse() to do the parsing.
If you did that, and you wanted to set the default filename to
something of your own choosing, I think the quoting would have to get
a little more unusual.  Maybe something like:

set -g logpane-default-logname "~/\"tmux-#S-#I-#P.log\""

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to