Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Ronald Otto Valentin Fischer
> 
> TWO - this fails, apparently (warning: my guess) at the pipe
> $ for j in 1 2;do echo $j $(echo hello | cat);done
> 1
> 2

This works for me:

$ for j in 1 2;do echo $j $(echo hello | cat);done
1 hello
2 hello

I have:

GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)

Ronald
-- 
Ronald Fischer 
http://www.fusshuhn.de/

--
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



Killing-Process woes

2017-06-20 Thread Ronald Otto Valentin Fischer
I'm spawning processes in background, but have problems killing them.
Here is the setup:

My script (zsh) creates one or more processes in the background, and
waits until they are finished. I have also set up a trap for SIGINT,
with the intention that if I press Control-C, the background processes
should be killed. I have verified the setup so far, that upon Control-C,
the trap function is indeed invoked, and I have all the PIDs of the
background processes. The problem is with the actual killing, and here
is why:

The background processes are actually (zsh-) scripts, which do some
setup (basically setting various environment variables), and then invoke
a (Cygwin-)Ruby program which does the "real work". The program is
executed by something like

ruby myprog.rb

(Note that this Ruby program is NOT invoked in background).

When my SIGINT trap is entered, I can see from ps indeed the
relationship between the processes involved, for instance

1085292966224  10536  cons33672028 08:05:10
/usr/bin/ruby
 929662246224  11236  cons33672028 08:05:10
 /usr/bin/zsh

The PID of my background process - the zsh wrapper - in this concrete
case is 9296, and we can see that this is the parent of the Ruby
process, 10852. The problem is that if I just kill 9296, the Ruby
process keeps running, orphaned:

10852   16224  10536  cons33672028 08:05:10
/usr/bin/ruby

I've found on Stackoverflow the suggestion to treat this as a process
group and use negative PIDs. I tried this too, but it didn't work. Here
is a similar example:

 5548   102765812   2376  cons33672028 08:20:43
 /usr/bin/ruby
1027658125812  10312  cons33672028 08:20:43
/usr/bin/zsh

If I do a

kill -- -10276

I get the error message

 kill: -10276: No such process

This happens both with the zsh-builtin kill and with /usr/bin/kill Is
there a simple way to kill the zsh process in addition to the ruby
process, or do I have to analyze the output of the ps command to
manually find the PID of the Ruby process and kill it?

Ronald
-- 
Ronald Fischer 
http://www.fusshuhn.de/


--
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



Re: Editors set x-bit (sometimes)

2016-12-13 Thread Ronald Otto Valentin Fischer

> Does this help?
> 
> https://cygwin.com/faq/faq.html#faq.using.same-with-permissions

While interesting, it seems to describe a different phenomenon.
Actually, when I create files by Cygwin tools only (touch, nano, ),
the access rights are always correct. Indeed, even after removing the
extended ACL entries - as was suggested in the FAQ -, the problem still
appears.

However, I have a new finding: When I create a file from a CMD.EXE
command line, by i.e.

echo xx > abc.rb

the access rights *do* have the x-bits set! This is reproducible, but
only when the file which was created, is below my Cygwin tree! I agree
that this smells a lot like an extended ACL issue, but as I said, 
setacl -b provided no help.

Ronald


-- 
Ronald Fischer 
http://www.fusshuhn.de/


--
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



Re: Possible bug with chere 1.4 when configuring for fish

2014-04-10 Thread Ronald Otto Valentin Fischer
 I've had more time to look around. If you add the following to the file 
 ~/.config/fish/config.fish (create it if you haven't already got one), 
 then things should work as intended:
 
 if status --is-login
   set PATH /usr/local/bin /usr/bin $PATH
 end
 
 Alternatively drop it in the fish global startup file, 
 /usr/share/fish/config.fish. 

I tried the variant of putting it into the global startup file, it
doesn't resolve the problem for me. I'll play around a bit with it as
soon as I have time (I'm a first-time user of fish and am busy with
other things right now, so this might take some time).

Ronald

--
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