* [9fans] p9p mk rc help @ 2013-11-20 11:13 dexen deVries 2013-11-20 14:11 ` erik quanstrom 2013-11-20 22:48 ` Tony Lainson 0 siblings, 2 replies; 5+ messages in thread From: dexen deVries @ 2013-11-20 11:13 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs Hi list, apologies for the keyword overload ;-) I have a plan9port mkfile using Rc (MKSHELL=$PLAN9/bin/rc), a recipe contains pipeline: FOO_COMMAND | BAR_COMMAND. What is the correct way of detecting failure exit status of FOO_COMMAND (a networked operation) and ignoring exit status of BAR_COMMAND? the best i came up with is very ugly: target: prereq FOO_COMMAND | BAR_COMMAND st = $status if (~ $st ?* ^ '|' ^ *) { echo FOO_COMMAND failed exit 3 } seems the | in pattern has to be quoted, otherwise is interpreted as pipe operator. regards, -- dx ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] p9p mk rc help 2013-11-20 11:13 [9fans] p9p mk rc help dexen deVries @ 2013-11-20 14:11 ` erik quanstrom 2013-11-20 14:49 ` arnold 2013-11-20 22:48 ` Tony Lainson 1 sibling, 1 reply; 5+ messages in thread From: erik quanstrom @ 2013-11-20 14:11 UTC (permalink / raw) To: 9fans > target: prereq > FOO_COMMAND | BAR_COMMAND > st = $status > if (~ $st ?* ^ '|' ^ *) { > echo FOO_COMMAND failed > exit 3 } i think there a bug in this. a trailing ~ 1 1 or similar is necessary to clear the status from the if. alternately, how about replacing the if with simply ! ~ $st ?* ^ '|' ^ * which should correctly set the status. - erik ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] p9p mk rc help 2013-11-20 14:11 ` erik quanstrom @ 2013-11-20 14:49 ` arnold 2013-11-20 15:58 ` erik quanstrom 0 siblings, 1 reply; 5+ messages in thread From: arnold @ 2013-11-20 14:49 UTC (permalink / raw) To: 9fans > ! ~ $st ?* ^ '|' ^ * Sheesh. I'm a long time Unix type and even to *me* that looks like line noise. :-) Arnold ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] p9p mk rc help 2013-11-20 14:49 ` arnold @ 2013-11-20 15:58 ` erik quanstrom 0 siblings, 0 replies; 5+ messages in thread From: erik quanstrom @ 2013-11-20 15:58 UTC (permalink / raw) To: arnold, 9fans On Wed Nov 20 10:57:46 EST 2013, arnold@skeeve.com wrote: > > ! ~ $st ?* ^ '|' ^ * > > Sheesh. I'm a long time Unix type and even to *me* that looks like > line noise. :-) ! ~ $status ?* ^ '|' ^ * ah, sorry. FTFY. - erik ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] p9p mk rc help 2013-11-20 11:13 [9fans] p9p mk rc help dexen deVries 2013-11-20 14:11 ` erik quanstrom @ 2013-11-20 22:48 ` Tony Lainson 1 sibling, 0 replies; 5+ messages in thread From: Tony Lainson @ 2013-11-20 22:48 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > What is the correct way of detecting failure exit status of > FOO_COMMAND (a networked operation) and ignoring exit status of > BAR_COMMAND? Perhaps something like this would work? target: fn ignore { $* || status=() } foo | ignore bar Tony ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-20 22:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-11-20 11:13 [9fans] p9p mk rc help dexen deVries 2013-11-20 14:11 ` erik quanstrom 2013-11-20 14:49 ` arnold 2013-11-20 15:58 ` erik quanstrom 2013-11-20 22:48 ` Tony Lainson
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).