Check input device is a terminal: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 260:
/*stick a fork in it, we're done.*/
</lang>
 
=={{header|Ring}}==
<lang ring>
# Project : Check input device is a terminal
# Date : 2018/05/01
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
load "stdlib.ring"
 
if isWindows()
write("mycmd.bat","
@echo off
timeout 1 2>nul >nul
if errorlevel 1 (
echo input redirected
) else (
echo input is console
)
")
see SystemCmd("mycmd.bat")
ok
</lang>
Output:
<pre>
input redirected
</pre>
 
=={{header|Ruby}}==
Example from the docs.
2,468

edits