Handle a signal: Difference between revisions

Removed Batch File (Batch cannot handle Ctrl+C signals...)
m (→‎{{header|Sidef}}: minor code fix and added output sample)
(Removed Batch File (Batch cannot handle Ctrl+C signals...))
Line 144:
6
Task took 3.526 Seconds</pre>
 
=={{header|Batch File}}==
<pre>
@echo off
set IntEchoedTimes= 0
echo X to send terminate signal
:LoopStart
set/a "IntEchoedTimes"= %IntEchoedTimes% + 1
choice /C 7X /N /T "1" /D 7
if %ERRORLEVEL% == 1 goto LoopStart
if %ERRORLEVEL% == 2 goto Terminate
:Terminate
echo The program has been running for %IntEchoedTimes% seconds.
echo Terminating...
timeout /t 3 /nobreak >nul
exit
</pre>
 
=={{header|BBC BASIC}}==
535

edits