X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=yP74nTYxgABoiNXKaLr2nJI/ZDh/6 yJlXWctnl0bA/oIe30NQmBoiMrZn9bl2+xAVaica19DnFBvcSc7cer4aR8wmxVJS Q4BPFNBIMLKMRowjaxXxnolruXyqMVw2VXvPjbSGFvwCoTe3KeAAuw87js2Gjnmx d3akHQxPuRb8KA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=RQJuzI27Ny/93HLloD9H2md27kM=; b=VGA ZWreGAQCr6wAayuDdKC3Q8cGCBQZYaugq7avq0B7vQNXV940ucNMm8t6XkehJBCc dWFDfHSUL+uvf+0l7PjbfthsmcAo0Y/ebdzZdU+lIse306Dg+/D9SzqtLLTRpFED ApxkK3JzXywu1htLlshsY1UCkLUlkuceKGqT9I64= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:645 X-HELO: mail-oi0-f44.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=HpeeFJ06tv/93+er1gYczaJyOqHoUZWQXZgzl1z9pMQ=; b=a3E4+CAVCn1qVWPw+E4SM+alAOW3yJIvEZwchgHLHLLrnDJTrglADdW1AuuES0ktby cW8oA9c16cRbWoCzcukArHC03H5Obw12IDdGAydu55Q+2D2QN3/Y/2/GrGgQGbZzzAwL SOuA+M0BNCSIuVCwhRSsoPk7aw5T6+LaEYzLdca0vHokrh+xAXkUnuu2vhEPuq8yX/ZE C6atFKa+BlPNwz3Be2Iv9hORCvP7FNb7mh5Itn1uSzBbk4aCGwhgp/oaNEkeWpeljYTd K4CZOxbgcMon55QTaE4bTTM+aHD4r2a9nr4zV162B52Xr7pDwsE6oCb2JVpgzUYK2PCl iv+g== MIME-Version: 1.0 From: =?UTF-8?Q?Jo=C3=A3o_Eiras?= Date: Fri, 20 Jul 2018 14:02:45 +0200 Message-ID: Subject: Why is stdin always a pipe? To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes Hi. I'm trying to figure out the best way to detect when my program is being piped data. So far I've used in linux often "[[ -p /dev/stdin ]]". During an interactive session, /dev/stdin will be a character device, not a pipe, and if stdin is closed ( command 0<&- ) then it's nothing. But in cygwin, /dev/stdin is ALWAYS a pipe. So, I could use "[[ -t 0 ]]" to check if stdin is a tty, but that would not cover when running my script in a background job or service with a closed stdin. So, a) what is the correct way to detect if stdin is being piped data and b) is this a bug or design limitation ? Thank you. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple