From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2587 invoked from network); 2 Mar 2022 20:19:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Mar 2022 20:19:20 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1646252360; b=M1f0xVTwrBo+znBxm39y55joN9oqymkMaryUZvwjcF24LmUZDvxli9RUI/ZTG75mh7yWRIbhIi JsN8uMFmKODhY65nOk4EsdNCFzgDtJCMH5yyGk4Ez288VUaQ3yj1A4ARIoOi3hGWQhNPrgk0h3 j9Jawqk40y31LyVWFHIX53+fBsH7gH02jQuBWe+tde9MvI48bBcFnW9paAPhEks/eN8ly3wVbX 5baovJ2Qk5bPdu9elL/A9/HI4ceF+uF2E8tP0nKrSNXVAZ0o/xlAZAEq/YY6l92Qzj2CuiCqSH b4bglVqSsozYpp/XtdSOcAEkrMN/iMWqBC6V+j3uSvmicg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1646252360; bh=HDmJvlqHbDeaiKKCtli3Gx7OLRdkr+Wx9muZkCxDvII=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=fA+FxtfFhw9vh8ie2Y9a48ABD3c3o+i+gSobnbOqMPqfgGWnxzyEZenfiNbtisbyHFLd1CbHZA Qj2GHcGqisUzlKhPyvjMvhjtM8XtijuInjWurqfA2LqXlyRVF+yIE55OLYIApmjyA9bcnbGou/ HbvVCZWMH580i/sMVOIl5VM8U8e6RHcHaPbnjPjTOjnHm0qPnh9Z/tlgMZqb4/7OIRErqhSBFU 8q7XHE4FnYhL00QyBpVqMaKlkOmz+hxLscX4yWv6aMGsClpxpg3EBhECW7TF9jPiRUrIyX9YPT k+6bdXl4X1i4omEgb6SdwKOBnC6pPfGkVJpvLeAEOaekhQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=IX5U6Sg4b/DhYIOO6bkmE2ELl2UWgrSKdVs0Oa2DlsI=; b=IDoiOUPF570/UhCeRVrYmUSgtA IFYaHQFUbpS5Vs8LOQRJvDwGrFYl20QhCW4oXUb2UaH1z90bXHUUoJ1+09fbq9Qhi1a50efiJICss Dl8/eMcLFJE5/M76Dq90zLO0PIRUXi//eybJy3quUf3xR/VMQJR0LQ0vaa6eX13WCA2vLKN63uW8C lICmd3FDr5Jza1sV2wBz6/9DJVf+ruiukR32QizVDGPFM5+v4/sPUozjgxDhIKIPNEaSsGtDjZWDC 7I8OGbeoYZ6R8QqrytylWlothGQCSyOdgVtBKUce4QI2Ywk9bKIKFhQGHH/z9vBPK9oVTWM/2iaO5 fNGWFjNQ==; Received: from authenticated user by zero.zsh.org with local id 1nPVRN-0001w1-Mm; Wed, 02 Mar 2022 20:19:17 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:49466) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1nPVQo-0001ch-Nt; Wed, 02 Mar 2022 20:18:43 +0000 Received: from [212.54.57.111] (helo=csmtp7.tb.ukmail.iss.as9143.net) by smtpq2.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPVQo-00062e-9i for zsh-workers@zsh.org; Wed, 02 Mar 2022 21:18:42 +0100 Received: from pws-Zeus ([82.1.229.179]) by cmsmtp with ESMTPA id PVQnnlVxVxQnDPVQonZqK8; Wed, 02 Mar 2022 21:18:42 +0100 X-SourceIP: 82.1.229.179 X-Authenticated-Sender: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.4 cv=VNbOIvDX c=1 sm=1 tr=0 ts=621fd122 cx=a_exe a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17 a=xNnLE9zTUD1jbiPY:21 a=IkcTkHD0fZMA:10 a=o8Y5sQTvuykA:10 a=Fc_Aj3PrMiISNq3CJLcA:9 a=QEXdDO2ut3YA:10 a=zXeNQK-WQ8sVPEEfHoKV:22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1646252322; bh=IX5U6Sg4b/DhYIOO6bkmE2ELl2UWgrSKdVs0Oa2DlsI=; h=Subject:From:To:Date:In-Reply-To:References; b=4VxYJDo7I5FZ2H+EETNVJLXYrIih8c6Qmk/SxAZliHCRspHqIRkTyV9LZ9xqaY/ot c76zwrQKgbp2DdzHTtmhvJRgTe5mDZtdaFqm5zs/EriH2Bu4GVfnL8ox5cGCONzUPE A+RiR0QZWimzaxWfGoSFD92fSzvzuFwUE4EYITsTqXIf8V7F2hWMGchYJR7iiuyCgh Li9pLf7xlD9sGJq8vnxcanNT0+H/WSzekDjfp5p2Li15nDySVHq4veYlib+knMdVgq J5bzNISFCViFMpHJkXrSLsFCIakdM5/+Y2yrNjvZKieR1addxL+YtKfMqppkL8Cv+r dMHhZp6jOE6RQ== Message-ID: Subject: Re: [Bug] $jobstates does not work in $() From: Peter Stephenson To: zsh-workers Date: Wed, 02 Mar 2022 20:18:41 +0000 In-Reply-To: <18fc86e5-467d-4753-9f82-6a3073874334@www.fastmail.com> References: <1912988517.1110378.1646131250968@mail2.virginmedia.com> <18fc86e5-467d-4753-9f82-6a3073874334@www.fastmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfPw1M3zwFZRoZPVLkpIukJPd/9a0NqHYGNRyQGKzfHZ5US+6fEi5qO0a0tRNRwGCzXf8/SBt9njnu/C3KGFSrVidpIrQJ8MUY/PDgW7mL7X/jd6QmRRr Esw4fJ8meXw0I+wei9/knXWBx+fuqwnS13CH/WVXBMZpAuHVWISoACcZPW4tSRgEXRyciEY1/ih4TA== X-Seq: 49787 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, 2022-03-02 at 09:44 +0000, Daniel Shahaf wrote: > Peter Stephenson wrote on Tue, 01 Mar 2022 10:40 +00:00: > Is this testable? Sorry, haven't got time to write a test myself right now. We could do something like this. pws diff --git a/Test/W02jobs.ztst b/Test/W02jobs.ztst index b09f2ac62..d52888dd9 100644 --- a/Test/W02jobs.ztst +++ b/Test/W02jobs.ztst @@ -144,12 +144,14 @@ zpty_start zpty_input 'sleep 3 &' zpty_input 'jobs -r' + zpty_input '(jobs -r)' zpty_input 'print -- -' zpty_input 'jobs -s' zpty_stop 0:`jobs -r` and `jobs -s` with running job *>\[1] [0-9]## *>\[1] + running*sleep* +*>\[1] + running*sleep* *>- *>zsh:*SIGHUPed* diff --git a/Test/W03jobparameters.ztst b/Test/W03jobparameters.ztst new file mode 100644 index 000000000..474adfaec --- /dev/null +++ b/Test/W03jobparameters.ztst @@ -0,0 +1,49 @@ +# Tests for interactive job control with parameter state + +%prep + + if zmodload zsh/zpty 2> /dev/null; then + zpty_start() { + export PS1= PS2= + zpty -d + zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z" + } + zpty_input() { + zpty -w zsh "${(F)@}" $'\n' + } + zpty_line() { + local REPLY + integer i + for (( i = 0; i < ${1:-1}; ++i )); do + zpty -r zsh REPLY + print -r -- ${REPLY%%($'\r\n'|$'\n')} + done + } + zpty_stop() { + # exit twice in case of check_jobs + zpty -w zsh $'exit\nexit\n' + # zpty gives no output when piped without these braces (?) + { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;' + zpty -d + : + } + if ! zmodload zsh/parameter 2> /dev/null; then + ZTST_unimplemented='the zsh/parameter module is not available' + fi + else + ZTST_unimplemented='the zsh/zpty module is not available' + fi + +%test + + zpty_start + zpty_input 'sleep 3 &' + zpty_input 'print $jobstates' + zpty_input '(print $jobstates)' + zpty_input 'jobs -s' + zpty_stop +0:$jobstate for running job in main shell and subshell +*>\[1] [0-9]## +*>running:+:*=running +*>running:+:*=running +*>zsh:*SIGHUPed*