0

Currently I encountered the following situation when bash script freeze on

PID=`cat test.pid`

After the analysis it was found that even this commands freeze

TEST=$(echo 1)
TEST=`echo 1`

Using set -x in bash script, I can see the following output

+ echo 1
1
++ echo 1

for script

#!/bin/bash
set -x
echo 1
TEST=$(echo 1)
set +x

This script is called from Qt process and everything have worked lately. When I call this script manually from bash it also works, but when I do it from process it fails. Currently I'm looking for possible reasons of such freezes, and I've no more ideas. When I printed environments they matched, but I also can't prinenv inside `` as it freezes also.

Ilya
  • 101
  • Could you post the calling code from your Qt program? – epsilon Jun 23 '14 at 10:01
  • It is a bit difficult, there would be a lot of code. Qt code have not changed and it worked just on a previous week and it even works now on another linux server. In few words it is `QProcess` that sets working directory, environment and binds stdout/stderr and calls `start( m_str, QIODevice::ReadOnly )`. – Ilya Jun 23 '14 at 10:14
  • Ok. What I would like to see is if you are calling bash from Qt or if you are passing your bash string. – epsilon Jun 23 '14 at 10:16
  • @jbh, I pass `m_str = trUtf8("./script.sh")` – Ilya Jun 23 '14 at 10:24
  • Have you make this script executable (chmod +x script.sh)? You could also look at process error status and errorString to help you debug this case – epsilon Jun 23 '14 at 10:34
  • As you can see I set `chmod +x` as script has already started and froze during command substitution code. No error is produced and there is no exit status as script is still running. – Ilya Jun 23 '14 at 10:50

0 Answers0