delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/12/16/09:41:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <C1076CA8EF84D5119E960002A5753CF9D27912@multimedia.prosodie.com>
From: Capiez Lionel <lcapiez AT prosodie DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: gawk : Input file remaining locked after program termination
Date: Mon, 16 Dec 2002 14:26:13 +0100
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id gBGEfws27978

Hi,

I have a gawk program that parses a file and spawns (as needed) an external
(non-gawk) program through the 'system(...)' built-in function. If the
external program remains active after gawk's termination, the file that was
used as the input to gawk remains locked and can not be modified.

Here is a code snippet the reproduces the issue :
(Put both files in a dir. where you have a few .txt files)

File foo.sh :
-----------------
ls *.txt > foobar
gawk -f bar.awk foobar >foobar.tmp
mv foobar.tmp foobar

File bar.awk :
-------------------
{
	print $1 " OK";
	system("notepad " $1 " &");	
}	


Running foo.sh produced the following output :
mv: cannot create regular file `foobar': Permission denied

And, as a side-effect, the 'foobar' file is deleted. 

Would someone know whether this is a gawk issue ? a cygwin issue ? a port of
gawk to cygwin issue ? or my missing something ?

As a side note, I tried to change the system call to 
	system ("nohup " $1 " >/dev/null &")
but to no avail.

Thanks in advance for your help. 
Lionel

--
Lionel Capiez
Ingénieur de développement
lcapiez AT prosodie DOT com
Tél. : 04 72 80 72 28
-------------------------------------------------
PROSODIE Lyon  - Direction des Moyens Informatiques
81, bd du Parc d'Artillerie  69007 Lyon
Tél. : 04 72 80 72 80 / Fax : 04.72.80.72.66
http://www.prosodie.com


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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