$chan1->exec("./a.out &"); or $chan1->exec("nohup ./a.out"); (as zentara suggested)