9front - general discussion about 9front
 help / color / mirror / Atom feed
* window(1) fixes
@ 2019-03-14  1:18 vp
  0 siblings, 0 replies; only message in thread
From: vp @ 2019-03-14  1:18 UTC (permalink / raw)
  To: 9front

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

Two problems were found in window(1):

1) window -m always 'fails', i.e. exits with a non-nil status.
This is because the last command in the -m path is a usually
false if-match which sets status='no match'.  The proposed
solution is to
	exit ''
explicitly after starting the background process.

2) window (with -m) and window (without -m) behaviours are
inconsistent with respect to the commands they can run;
where the former admits only a single command to be passed
along to exec(1), and the latter will happily run arbitrary
rc command lines through rio's 'new' wctl.  The proposed
solution is to exec the command through rc -c, same way rio
does.

Attached are the proposed fixes.

[-- Attachment #2: window.exit.diff --]
[-- Type: text/plain, Size: 229 bytes --]

diff --git a/rc/bin/window b/rc/bin/window
--- a/rc/bin/window
+++ b/rc/bin/window
@@ -86,6 +86,7 @@ if(~ $#mflag 1) {
 			exec $argv0 -x $cmd </dev/cons >/dev/cons >[2]/dev/cons
 		}
 	}&
+	exit ''
 }
 if not {
 	if(~ $wctl ''){

[-- Attachment #3: window.cmd.diff --]
[-- Type: text/plain, Size: 389 bytes --]

diff --git a/rc/bin/window b/rc/bin/window
--- a/rc/bin/window
+++ b/rc/bin/window
@@ -83,7 +83,7 @@ if(~ $#mflag 1) {
 		{unmount /mnt/acme /dev; unmount $wsys /dev} >[2]/dev/null
 		if(mount $wsys /mnt/wsys 'new '$"spec){
 			bind -b /mnt/wsys /dev
-			exec $argv0 -x $cmd </dev/cons >/dev/cons >[2]/dev/cons
+			exec $argv0 -x rc -c $cmd </dev/cons >/dev/cons >[2]/dev/cons
 		}
 	}&
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-14  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14  1:18 window(1) fixes vp

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).