Glibmm spawn_async_with_pipes.



I'm using spawn_async_with_pipes from a c++ program.
I tried to send an "ls" command and everything is correct.
I know this is not exactly a gtkmm question, but I don't know
where to ask for this.
Basically, I want to be able to authenticate to enter an ipod
via ssh and to be able to send commands to the ipod and get
the output, all of it sending commands via ssh.

But when trying to use "ssh" and "user server com",
the output is shown in the terminal. I want it to be redirected
to the file descriptors, because I need to feed the program with
the ssh password. I have this code:

	int pid, stdinput, stdoutput, stderror;
	std::vector<std::string> argvproc, envpproc;
	argvproc.push_back("ssh");
	argvproc.push_back("root 192 168 1 20");
	

	Glib::spawn_async_with_pipes(Glib::get_current_dir(), argvproc,
envpproc, Glib::SPAWN_SEARCH_PATH,
				     sigc::slot<void>(),
				     &pid, &stdinput,
				     &stdoutput, &stderror);


The output in the terminal is something like this:

root 192 168 1 20's password:
root 192 168 1 20's password:
root 192 168 1 20's password:

It outputs this 3 times. With ls I don't get even output because it is
(correctly) redirected to stdinput. Any help here, please?

I would like to be able to:

wait for ssh to ask the password. Send commands to the ssh process and
get them from the main process.

Thanks in advance.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]