delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/12/29/20:46:29

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F25093858C27
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1609292737;
bh=IDaGghYLs644y1wo94KD7dcnNns+nc1rFbOyKO6s87Q=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=Ke9fYtarYA+cLVeoKpvHo65Dab5mKW6aPiK4wW3I0bK1+NtLBHqj9cXYMnGGV8YWE
gcbCHKgSF8Kov/wyKsUZEjhwHaQUUZ8E/2JkJ8/+5y8It68cgcuA8AwqoLRSYLUJ7M
bfupSFP4FstdUKuQ/0yaqTVo0nygO0gfPyYRa6Zk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AE5F13858C27
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 0BU1itR2031791
X-Nifty-SrcIP: [122.249.67.108]
Date: Wed, 30 Dec 2020 10:45:04 +0900
To: cygwin AT cygwin DOT com
Subject: Re: tee: 'standard output': Permission denied
Message-Id: <20201230104504.26f3064d3c231c6669637b6d@nifty.ne.jp>
In-Reply-To: <1626660026.20201230005056@inbox.ru>
References: <1939012153 DOT 20201227050421 AT inbox DOT ru>
<1626660026 DOT 20201230005056 AT inbox DOT ru>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP,
WEIRD_QUOTING autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Cc: Andry <andry AT inbox DOT ru>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

On Wed, 30 Dec 2020 00:50:56 +0300
Andry via Cygwin <cygwin AT cygwin DOT com> wrote:
> Hello Cygwin,
> 
>   >I am trying to change directory before run a bash shell with login:
> 
>   I've minimized to a minimal example to repro the issue:
> 
>   *run_cygwin_bash.bat*:
> 
>   ```
>   @echo off
> 
>   set CYGWIN_ROOT=...
>   set PWD=...
>   set PROJECT_LOG_FILE=...
> 
>   chcp.com 65001 >nul
> 
> 
>   "%CYGWIN_ROOT%\bin\bash.exe" -c "{ cd ""%PWD:\=/%""; CHERE_INVOKING=. ""%CYGWIN_ROOT:\=/%/bin/bash.exe"" -l -i; } 2>&1 | ""%CYGWIN_ROOT:\=/%/bin/tee.exe"" -a ""%PROJECT_LOG_FILE:\=/%"""
>   ```
> 
>   To execute:
> 
>   ```
>   c:\> start "" cmd.exe /C run_cygwin_bash.bat
> 
>   ```
> 
>   To stall:
> 
>   ```
>   $ 123
>   c:/cygwin/bin/tee: 'standard output': Permission denied
>   ```
> 
>   It repro only if:
> 
>   `chcp.com 65001` used together with `start "" cmd.exe ...`

I cannot reproducue your problem even with chcp.com 65001 and
start "" cmd.exe ...

By the way, using tee for logging the output is not good
idea because stdout is not a tty. Due to this, less command
does not work properly.

Instead, I recommend:

@echo off
set CYGWIN_ROOT=...
set PROJECT_LOG_FILE=...

"%CYGWIN_ROOT%\bin\script" -q -a "%PROJECT_LOG_FILE%" -c "chcp.com 65001 > /dev/null 2>&1; /bin/bash --login"


-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019