If you fork (exec) two interactive bash processes within same parent process (from different threads) causes that parent process becomes stopped or second interactive bash goes to background which further causes that second bash consumes 100% CPU because of conflicts of interactive and background attributes.
This is happening in Linux but not in Cygwin.
Example:
In same Java process (same thing is happening in other programming language):
Thread 1
Process process1;
String[] command1 = new String[] { "bash", "-l", "-c", "bash -i -l 2>&1" };
process1 = Runtime.getRuntime().exec(command1);
Thread 2
Process process2;
String[] command2 = new String[] { "bash", "-l", "-c", "bash -i -l 2>&1" };
process2 = Runtime.getRuntime().exec(command2);
What is causing such behavior?
If above example is executed in two separate processes there are no problems. So, it seems related to fact that those bash processes have same root parent process (and maybe confusing tty and control signals).
Thanks for help.