[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] run-parts, trap INT, read error
From: |
Eduardo A . Bustamante López |
Subject: |
Re: [Help-bash] run-parts, trap INT, read error |
Date: |
Tue, 24 Mar 2015 18:09:52 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
> $ ./test.d/child: line 7: read: read error: 0: Input/output error
> ++ true 'answer: '
> + true END
> Where is the read error coming from?
Well, the message is pretty clear, the error is in the 'read', in child.
> Why is the script continuing to run in background?
Because you trapped INT, so you removed the default action of terminating the
script.
> If I use './test.d/child' instead of run-parts, this issue does not happen.
This seems to be a run-parts issue. I was able to reproduce it without much
cruft, like this:
address@hidden ~ % run-parts t
+ read x
^C++ echo int
int
t/s: line 4: read error: 0: Input/output error
address@hidden ~ % cat t/s
#!/bin/bash
trap 'echo int' INT
set -x
read x
So, for some reason, run-parts does something that read doesn't like. The
problem is that I can't strace/ltrace it, because when I do that, the problem
disappears.
You might want to reconsider your scripts also.