public function exec($command, $timeout=30, $with_login_env=true)
    {
        stream_set_timeout($this->shell, $timeout);
        if($with_login_env){
            $command = 'bash -l '.$command;
        }

        return fwrite($this->shell, $command.PHP_EOL);
    }