zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Make subshells non-interactive
@ 2006-07-31 11:57 Simon 'corecode' Schubert
  2006-07-31 13:38 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Simon 'corecode' Schubert @ 2006-07-31 11:57 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 795 bytes --]

[please cc: me on replies]

Hey,

I noticed that subshells of an interactive shell consider themself interactive as well.  I am not sure if this is desired, but making them non-interactive helps to solve my real issue:

when executing

	zsh% (cd .)

my chpwd function is executed.  In a subshell, I want to avoid that.  Making the subshell be non-interactive and checking [[ -o interactive ]] in my chpwd() does the trick, but maybe there is a better solution?

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

[-- Attachment #1.2: zsh-subsh-noninteractive.diff --]
[-- Type: text/plain, Size: 362 bytes --]

--- Src/exec.c~	2005-04-27 12:01:39.000000000 +0200
+++ Src/exec.c	2006-07-31 13:28:15.000000000 +0200
@@ -2705,7 +2705,7 @@
     }
     if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED))
 	signal_default(SIGQUIT);
-    opts[MONITOR] = opts[USEZLE] = 0;
+    opts[MONITOR] = opts[USEZLE] = opts[INTERACTIVE] = 0;
     zleactive = 0;
     if (cl)
 	clearjobtab(monitor);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: PATCH: Make subshells non-interactive
  2006-07-31 11:57 PATCH: Make subshells non-interactive Simon 'corecode' Schubert
@ 2006-07-31 13:38 ` Peter Stephenson
  2006-07-31 14:41   ` Simon 'corecode' Schubert
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2006-07-31 13:38 UTC (permalink / raw)
  To: zsh-workers, corecode

"Simon 'corecode' Schubert" wrote:
> I noticed that subshells of an interactive shell consider themself intera=
> ctive as well.  I am not sure if this is desired, but making them non-int=
> eractive helps to solve my real issue:
> 
> when executing
> 
> 	zsh% (cd .)
> 
> my chpwd function is executed.  In a subshell, I want to avoid that.
> Making the subshell be non-interactive and checking [[ -o interactive ]]
> in my chpwd() does the trick, but maybe there is a better solution?

Could you not test one of the existing options which is reset, zle or
monitor?

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


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

* Re: PATCH: Make subshells non-interactive
  2006-07-31 13:38 ` Peter Stephenson
@ 2006-07-31 14:41   ` Simon 'corecode' Schubert
  0 siblings, 0 replies; 3+ messages in thread
From: Simon 'corecode' Schubert @ 2006-07-31 14:41 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

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

Peter Stephenson wrote:
> "Simon 'corecode' Schubert" wrote:
>> I noticed that subshells of an interactive shell consider themself intera=
>> ctive as well.  I am not sure if this is desired, but making them non-int=
>> eractive helps to solve my real issue:
>>
>> when executing
>>
>> 	zsh% (cd .)
>>
>> my chpwd function is executed.  In a subshell, I want to avoid that.
>> Making the subshell be non-interactive and checking [[ -o interactive ]]
>> in my chpwd() does the trick, but maybe there is a better solution?
> 
> Could you not test one of the existing options which is reset, zle or
> monitor?

ah well, yes of course.  it just seemed odd that a subshell which is not reading commands from stdin will be interactive.

For example, (pushd) will print the dirstack.  On the other hand, (fc) will output the recent history, without being interactive it is unhappy, but I don't see much reason calling fc from a subshell.

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

end of thread, other threads:[~2006-07-31 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-31 11:57 PATCH: Make subshells non-interactive Simon 'corecode' Schubert
2006-07-31 13:38 ` Peter Stephenson
2006-07-31 14:41   ` Simon 'corecode' Schubert

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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