Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

True. You have to work it around by using something like:

echo "sleep 1000 &" > /tmp/sleep_on_background.sh ; bash /tmp/sleep_on_background.sh
yoav

Hi Prikryl.

Thanks for the answer.

I tried to run the command on backround but got an error:

for the code:
CommandExecutionResult cmdExResult;
cmdExResult = curSession.ExecuteCommand("sleep 10000 &");


cmdExResult.outpot is:

"-bash: line 40: syntax error near unexpected token `;'\n-bash: line 40: `sleep 10000 & ; echo \"WinSCP: this is end-of-file:$?\"'"

can you please advise?

Thanks
martin

Re: Need to abort ExecuteCommand before it returns

On a typical *nix server, you can run a command on a background using & operator, to avoid blocking the shell.

E.g.: session.ExecuteCommand("sleep 1000 &").Check();
yoav

Need to abort ExecuteCommand before it returns

Hi,

I am using .NET assembly with csharp.

I send command to remote server with ExecuteCommand method.

this command at the remote server does not stop alone but only with CTL C

so in my c sharp code - ExecuteCommand method dose not return and cpu is stuck in this line.

is there any way to ecutes command on the remote server with no waiting to the remote server output?

do you have an idea how can I solve this issue?

thanks alot