9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] window -hide rc -c 'label a_name; tail -f some_file'
@ 2008-10-08 18:26 Rudolf Sykora
  2008-10-08 18:42 ` Pietro Gagliardi
  2008-10-08 18:43 ` andrey mirtchovski
  0 siblings, 2 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-10-08 18:26 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

Hello,

I'd expect

window -hide  rc -c 'label a_name; tail -f some_file'

would create a new hidden window (and so it does), run the tail command (and
so it does) and set the name for the hidden window to a_name.
The last thing seems to not happen (at least from the viewpoint of using the
button-3 menu in rio --- I only see an empty field, i. e. without any name).
Can anyone tell me what's wrong?

Thanks
Ruda

[-- Attachment #2: Type: text/html, Size: 496 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 18:26 [9fans] window -hide rc -c 'label a_name; tail -f some_file' Rudolf Sykora
@ 2008-10-08 18:42 ` Pietro Gagliardi
  2008-10-08 19:01   ` Rudolf Sykora
  2008-10-08 18:43 ` andrey mirtchovski
  1 sibling, 1 reply; 7+ messages in thread
From: Pietro Gagliardi @ 2008-10-08 18:42 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Oct 8, 2008, at 2:26 PM, Rudolf Sykora wrote:

> Hello,
>
> I'd expect
>
> window -hide  rc -c 'label a_name; tail -f some_file'
>
> would create a new hidden window (and so it does), run the tail
> command (and so it does) and set the name for the hidden window to
> a_name.
> The last thing seems to not happen (at least from the viewpoint of
> using the button-3 menu in rio --- I only see an empty field, i. e.
> without any name).
> Can anyone tell me what's wrong?
>
> Thanks
> Ruda

rc -c only runs the commands given and then terminates. When all the
processes given to window terminates, the window closes. That's what's
happening to you. Try this:

window -hide 'label a_name; tail -f some_file; rc'




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 18:26 [9fans] window -hide rc -c 'label a_name; tail -f some_file' Rudolf Sykora
  2008-10-08 18:42 ` Pietro Gagliardi
@ 2008-10-08 18:43 ` andrey mirtchovski
  2008-10-08 19:11   ` Rudolf Sykora
  1 sibling, 1 reply; 7+ messages in thread
From: andrey mirtchovski @ 2008-10-08 18:43 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

see the window(1) man page regarding the -m option passed to the
command and what it does in this case. not to repeat everything here,
but it suffices to say that

window -m -hide  rc -c 'label a_name; tail -f /sys/log/telnet'

works as expected.

note that -m must appear first in the argument list. you can consider
this a bug if you'd like.

On Wed, Oct 8, 2008 at 12:26 PM, Rudolf Sykora <rudolf.sykora@gmail.com> wrote:
> Hello,
>
> I'd expect
>
> window -hide  rc -c 'label a_name; tail -f some_file'
>
> would create a new hidden window (and so it does), run the tail command (and
> so it does) and set the name for the hidden window to a_name.
> The last thing seems to not happen (at least from the viewpoint of using the
> button-3 menu in rio --- I only see an empty field, i. e. without any name).
> Can anyone tell me what's wrong?
>
> Thanks
> Ruda
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 18:42 ` Pietro Gagliardi
@ 2008-10-08 19:01   ` Rudolf Sykora
  0 siblings, 0 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-10-08 19:01 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

window -hide  rc -c 'label a_name; tail -f some_file'
>>
>>
> rc -c only runs the commands given and then terminates. When all the
> processes given to window terminates, the window closes. That's what's
> happening to you. Try this:
>
> window -hide 'label a_name; tail -f some_file; rc'


First, it does not terminate, as you could easily try (thanks to the -f
switch of tail).
Second, your proposal does not work any better than mine.
R.

[-- Attachment #2: Type: text/html, Size: 899 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 18:43 ` andrey mirtchovski
@ 2008-10-08 19:11   ` Rudolf Sykora
  2008-10-08 20:40     ` andrey mirtchovski
  0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Sykora @ 2008-10-08 19:11 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

2008/10/8 andrey mirtchovski <mirtchovski@gmail.com>

> see the window(1) man page regarding the -m option passed to the
> command and what it does in this case. not to repeat everything here,
> but it suffices to say that
>
> window -m -hide  rc -c 'label a_name; tail -f /sys/log/telnet'
>
> works as expected.
>
> note that -m must appear first in the argument list. you can consider
> this a bug if you'd like.


Thanks. It really works. I read about that -m option again. I've actually
already used it before. But somehow I still don't understand why it helps...
What if I (for some reason)  don't want the namespace to be copied?
R.

[-- Attachment #2: Type: text/html, Size: 1001 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 19:11   ` Rudolf Sykora
@ 2008-10-08 20:40     ` andrey mirtchovski
  2008-10-09  7:31       ` Rudolf Sykora
  0 siblings, 1 reply; 7+ messages in thread
From: andrey mirtchovski @ 2008-10-08 20:40 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

scratch my previous explanation. it is incorrect. looking through
rio's source code it appears that the cause is the supplied "rc -c"
argument to 'window'. the window command assumes that everything after
the switches is a command to be executed and actually prepends 'rc -c'
in front of your command line. due to quoting and other mishaps, the
end effect is that the command as specified (i'm testing with "sleep"
instead of "tail -f") is executed as:

rc -c 'rc -c label test; sleep 20' (quoting as per the rio window manager)

instead, you should probably just do:

window 'label test; sleep 20', which will be executed as:

rc -c 'label test; sleep 20'

and will work fine even without the -m switch.

you can see for yourself the described behaviour via the following
test on a plain shell (all execute commands to be run without the
double quotes):

1: execute "rc -c 'label test; sleep 20'"
2: hide the window (you'll see the label 'test')
3: unhide the window and terminate the sleep
4: execute "rc -c 'rc -c label test; sleep 20'"
5: hide the window (you'll see an empty entry for the window label)
6: unhide the window. notice that the label remains empty even after
the sleep has completed

finally, try a fully escaped shell to see that it works:
7: execute "rc -c 'rc -c ''label test; sleep 20'''"
8: hide the window

why rc behaves this way is a different matter altogether. i'll leave
it to you, but i encourage you to dig in the source. i figured all
this out after editing the rio source and adding a piece of code to
print me the argument list it executes for a new window. i doubt
you'll ever find an easier source to deal with than on plan9. rio is
only 5K lines of code and acme makes navigation through that code a
bliss. same goes for almost everything else in the system.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] window -hide rc -c 'label a_name; tail -f some_file'
  2008-10-08 20:40     ` andrey mirtchovski
@ 2008-10-09  7:31       ` Rudolf Sykora
  0 siblings, 0 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-10-09  7:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]

2008/10/8 andrey mirtchovski <mirtchovski@gmail.com>

> scratch my previous explanation. it is incorrect. looking through
> rio's source code it appears that the cause is the supplied "rc -c"
> argument to 'window'. the window command assumes that everything after
> the switches is a command to be executed and actually prepends 'rc -c'
> in front of your command line. due to quoting and other mishaps, the
> end effect is that the command as specified (i'm testing with "sleep"
> instead of "tail -f") is executed as:
>
> rc -c 'rc -c label test; sleep 20' (quoting as per the rio window manager)
>
> instead, you should probably just do:
>
> window 'label test; sleep 20', which will be executed as:
>
> rc -c 'label test; sleep 20'
>
> and will work fine even without the -m switch.
>
> you can see for yourself the described behaviour via the following
> test on a plain shell (all execute commands to be run without the
> double quotes):
>
> 1: execute "rc -c 'label test; sleep 20'"
> 2: hide the window (you'll see the label 'test')
> 3: unhide the window and terminate the sleep
> 4: execute "rc -c 'rc -c label test; sleep 20'"
> 5: hide the window (you'll see an empty entry for the window label)
> 6: unhide the window. notice that the label remains empty even after
> the sleep has completed
>
> finally, try a fully escaped shell to see that it works:
> 7: execute "rc -c 'rc -c ''label test; sleep 20'''"
> 8: hide the window
>
> why rc behaves this way is a different matter altogether. i'll leave
> it to you, but i encourage you to dig in the source. i figured all
> this out after editing the rio source and adding a piece of code to
> print me the argument list it executes for a new window. i doubt
> you'll ever find an easier source to deal with than on plan9. rio is
> only 5K lines of code and acme makes navigation through that code a
> bliss. same goes for almost everything else in the system.
>
> Thanks a lot. I probably just wouldn't be able to find that :) I'll try and
go through the code myself.
Just one last question concerning this. Is it the right, expected behaviour
of the window command, or should the original version work and sth. should
be changed?
Ruda

[-- Attachment #2: Type: text/html, Size: 2805 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-10-09  7:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-08 18:26 [9fans] window -hide rc -c 'label a_name; tail -f some_file' Rudolf Sykora
2008-10-08 18:42 ` Pietro Gagliardi
2008-10-08 19:01   ` Rudolf Sykora
2008-10-08 18:43 ` andrey mirtchovski
2008-10-08 19:11   ` Rudolf Sykora
2008-10-08 20:40     ` andrey mirtchovski
2008-10-09  7:31       ` Rudolf Sykora

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).