public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
@ 2014-12-23 11:09 -
  2014-12-23 11:37 ` Marco Atzeri
  2014-12-23 13:00 ` -
  0 siblings, 2 replies; 9+ messages in thread
From: - @ 2014-12-23 11:09 UTC (permalink / raw)
  To: marco, cygwin, Anr Daemon

>> Using Taskmanager is brute force as cygwin dll can not act and correctly manage the exitcode


Hi,

thanks, but I do not agree. One element of the script was killed, not
the hoöe script. It should be more robust. What I do now is: Read
stdout of the program (rsync) and only if I got the right footer of
rsync I rely on exitcode 0.

That is insane.

Is it possible to kill the process of a script element in GNU and
having a returncode of 0 and a continuing script? If yes we can't use
returncodes at all anymore in shell scripts?

Thanks lopiuh

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23 11:09 Exitcode is 0 when killing a cygwin initiated process via taskmanager -
@ 2014-12-23 11:37 ` Marco Atzeri
  2014-12-23 13:00 ` -
  1 sibling, 0 replies; 9+ messages in thread
From: Marco Atzeri @ 2014-12-23 11:37 UTC (permalink / raw)
  To: cygwin

On 12/23/2014 12:09 PM, - wrote:
>>> Using Taskmanager is brute force as cygwin dll can not act and correctly manage the exitcode
>
>
> Hi,
>
> thanks, but I do not agree. One element of the script was killed, not
> the hoöe script.

It was not killed in the proper cygwin way.

 > It should be more robust. What I do now is: Read
> stdout of the program (rsync) and only if I got the right footer of
> rsync I rely on exitcode 0.
>
> That is insane.

your opinion.

For me, it is simple: if you want a Unix like behavior use cygwin kill.

Otherwise propose a patch...
https://cygwin.com/acronyms/#PTC


> Is it possible to kill the process of a script element in GNU and
> having a returncode of 0 and a continuing script? If yes we can't use
> returncodes at all anymore in shell scripts?
>
> Thanks lopiuh
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23 11:09 Exitcode is 0 when killing a cygwin initiated process via taskmanager -
  2014-12-23 11:37 ` Marco Atzeri
@ 2014-12-23 13:00 ` -
  2014-12-23 19:47   ` cyg Simple
  2014-12-24  1:56   ` -
  1 sibling, 2 replies; 9+ messages in thread
From: - @ 2014-12-23 13:00 UTC (permalink / raw)
  To: marco, cygwin, Anr Daemon

Hi Marco,

I agree and I didn't want to rant. I just consider robustness and I
can not rely on or guarantee that cygwin kill ist used. (It is the
user of the Windows machine being creative ;-)

I scratch my head if we have a similar situation in GNU/Linux.

If anything went havoc I so far supposed that exit code or abrupt
script breakdown (stop) cares about not doing nasty things.

So at the moment if you consider the OS or a user kills a process with
Taskmanager we have to use another error handling in scripts at the
moment. Is that  true in GNU/Linux as well? What do you think? I can't
find a clear answer in the www so far.

If it is similar in GNU/Linux we have a general problem I suppose. If
it is a cygwin thing, it is a feature which behaves different to the
real posix world?!


Greetings lopiuh

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23 13:00 ` -
@ 2014-12-23 19:47   ` cyg Simple
  2014-12-24  1:56   ` -
  1 sibling, 0 replies; 9+ messages in thread
From: cyg Simple @ 2014-12-23 19:47 UTC (permalink / raw)
  To: cygwin

> 
> I scratch my head if we have a similar situation in GNU/Linux.
> 
> If anything went havoc I so far supposed that exit code or abrupt script
> breakdown (stop) cares about not doing nasty things.
> 
> So at the moment if you consider the OS or a user kills a process with
> Taskmanager we have to use another error handling in scripts at the moment. Is
> that  true in GNU/Linux as well? What do you think? I can't find a clear answer in
> the www so far.
> 
> If it is similar in GNU/Linux we have a general problem I suppose. If it is a cygwin
> thing, it is a feature which behaves different to the real posix world?!

Cygwin is a POSIX environment executing within the Windows OS environment.  If things happen outside of the Cygwin environment it cannot  detect those.  You must train your users to not use the Windows Task Manager to kill the process outside of the Cygwin environment.

The problem does not exist in Linux because there isn't an environment inside an environment so there isn't a chance to use the tools improperly.

--
cyg Simple


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23 13:00 ` -
  2014-12-23 19:47   ` cyg Simple
@ 2014-12-24  1:56   ` -
  1 sibling, 0 replies; 9+ messages in thread
From: - @ 2014-12-24  1:56 UTC (permalink / raw)
  To: marco, cygwin, Anr Daemon, cygsimple

>> If it is similar in GNU/Linux we have a general problem I suppose. If it is a cygwin
>> thing, it is a feature which behaves different to the real posix world?!

> Cygwin is a POSIX environment executing within the Windows OS environment.
>  If things happen outside of the Cygwin environment it cannot  detect those.
>  You must train your users to not use the Windows Task Manager to kill the process outside of the Cygwin environment.

> The problem does not exist in Linux because there isn't an environment inside an environment so there isn't a chance
> to use the tools improperly.

Ok I wrote a wrapper and check stdout of critical commands. If I get
returnvalue 0 but not expectet stdout I panic. As far as my critical
part is rsync that is a safe bet (there is a nice footer when rsync
was not interrupted).

As far as robustness is concerned I must say I am happy having found
this edge very early.

What do you think is that topic worth an entry in FAQ/Documentation?
On the other hand this thread will be found through google search...

Thanks again for being supportive and all your work!

lopiuh

keywords: cygwin returnvalue errorcode taskmanager exitcode process
kill end continue zero errorvalue unset

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23  2:34 -
@ 2014-12-23  7:41 ` Marco Atzeri
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Atzeri @ 2014-12-23  7:41 UTC (permalink / raw)
  To: cygwin

On 12/23/2014 3:33 AM, - wrote:
> Hi,
>
>>> Any idea how to solve (get the "canceled" exit code? Remember: The
>>> script continues like a normal finish of the command)
>
>> What do you mean by "canceled" exit code, pretty please?
>
> oh, any exitcode <> 0 would be nice. Sending sigkill on debian gives a 137.
>
> The point is, I rely on having a successfully executed command, if
> exitcode is 0. In this case command is terminated, left garbage and
> did not do its job and I go on like everything would be fine. How
> should error checking care about such a condition / state?
>
> Any ideas? And by the way, is such a condition in pure GNU/Linux
> producible? Sigkill is quite brute force exit isn't it?

no. It is just the standard way, you ask the program to kill itself.
In that case

result: 143

Using Taskmanager is brute force as cygwin dll can not act
and correctly manage the exitcode

Regards
Marco


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
@ 2014-12-23  2:34 -
  2014-12-23  7:41 ` Marco Atzeri
  0 siblings, 1 reply; 9+ messages in thread
From: - @ 2014-12-23  2:34 UTC (permalink / raw)
  To: cygwin, anrdaemon

Hi,

>> Any idea how to solve (get the "canceled" exit code? Remember: The
>> script continues like a normal finish of the command)

> What do you mean by "canceled" exit code, pretty please?

oh, any exitcode <> 0 would be nice. Sending sigkill on debian gives a 137.

The point is, I rely on having a successfully executed command, if
exitcode is 0. In this case command is terminated, left garbage and
did not do its job and I go on like everything would be fine. How
should error checking care about such a condition / state?

Any ideas? And by the way, is such a condition in pure GNU/Linux
producible? Sigkill is quite brute force exit isn't it?

Thanks

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Exitcode is 0 when killing a cygwin initiated process via taskmanager
  2014-12-23  0:38 -
@ 2014-12-23  1:50 ` Andrey Repin
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Repin @ 2014-12-23  1:50 UTC (permalink / raw)
  To: -, cygwin

Greetings, -!

> I have a script running banana after killing a process (rsync, but
> that is unimportant) through Taskmanager (End process in process tab).

> It is, that the killed process exits  immediately with exitcode 0 (!)
> and the bash script itself continues, which can lead to havoc because
> not knowing something was canceled (continuing to mive directories
> etc).

> Win7, CYGWIN_NT-6.1-WOW64 Gizmo-PC 1.7.33-2(0.280/5/3) 2014-11-13
> 15:45 i686 Cygwin

> simple to reproduce:
> START script.sh
> #!/usr/bin/bash
> less some_file
> echo "result: $?" >| erg_file

> erg_file contains: result: 0 after killing less through process taskmanager

> Any idea how to solve (get the "canceled" exit code? Remember: The
> script continues like a normal finish of the command)

What do you mean by "canceled" exit code, pretty please?


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 23.12.2014, <04:37>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Exitcode is 0 when killing a cygwin initiated process via taskmanager
@ 2014-12-23  0:38 -
  2014-12-23  1:50 ` Andrey Repin
  0 siblings, 1 reply; 9+ messages in thread
From: - @ 2014-12-23  0:38 UTC (permalink / raw)
  To: cygwin

Hi all,

I have a script running banana after killing a process (rsync, but
that is unimportant) through Taskmanager (End process in process tab).

It is, that the killed process exits  immediately with exitcode 0 (!)
and the bash script itself continues, which can lead to havoc because
not knowing something was canceled (continuing to mive directories
etc).

Win7, CYGWIN_NT-6.1-WOW64 Gizmo-PC 1.7.33-2(0.280/5/3) 2014-11-13
15:45 i686 Cygwin

simple to reproduce:
START script.sh
#!/usr/bin/bash
less some_file
echo "result: $?" >| erg_file

erg_file contains: result: 0 after killing less through process taskmanager

Any idea how to solve (get the "canceled" exit code? Remember: The
script continues like a normal finish of the command)

Thanks

lopiuh

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-12-24  1:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 11:09 Exitcode is 0 when killing a cygwin initiated process via taskmanager -
2014-12-23 11:37 ` Marco Atzeri
2014-12-23 13:00 ` -
2014-12-23 19:47   ` cyg Simple
2014-12-24  1:56   ` -
  -- strict thread matches above, loose matches on Subject: below --
2014-12-23  2:34 -
2014-12-23  7:41 ` Marco Atzeri
2014-12-23  0:38 -
2014-12-23  1:50 ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).