This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gawk : Input file remaining locked after program termination


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@prosodie.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]