Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
4ca33c11
Commit
4ca33c11
authored
10 years ago
by
Katsu Kawakami
Browse files
Options
Downloads
Patches
Plain Diff
Check if stdin is from a tty
parent
f8dc38c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib.rs
+15
-2
15 additions, 2 deletions
src/lib.rs
with
15 additions
and
2 deletions
src/lib.rs
+
15
−
2
View file @
4ca33c11
#[test]
fn
it_works
()
{
#![feature(libc)]
extern
crate
libc
;
pub
fn
readline
()
->
Option
<
String
>
{
// Buffer to hold readline input
let
buffer
=
String
::
new
();
let
isatty
=
unsafe
{
libc
::
isatty
(
libc
::
STDIN_FILENO
as
i32
)
}
!=
0
;
if
isatty
{
println!
(
"stdin is a tty"
);
}
else
{
println!
(
"stdin is not a tty"
);
}
buffer
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment