-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(bootstrap): fix import command handling of no input piped to stdin #288
Conversation
0a8aa20
to
1259ca1
Compare
1259ca1
to
bdc85e3
Compare
bdc85e3
to
02ccf87
Compare
02ccf87
to
280eda0
Compare
280eda0
to
65be559
Compare
65be559
to
86d0c33
Compare
86d0c33
to
c295e5d
Compare
c295e5d
to
389acd1
Compare
389acd1
to
e218c8d
Compare
e218c8d
to
d82b2eb
Compare
d82b2eb
to
21d9e09
Compare
21d9e09
to
6fcfee6
Compare
6fcfee6
to
fd9950f
Compare
09aedf4
to
68d174b
Compare
68d174b
to
9fa2ad9
Compare
9fa2ad9
to
56dc681
Compare
56dc681
to
85dbc14
Compare
85dbc14
to
f56765f
Compare
I was thinking of something more like, let data = if let Some(path) = matches.value_of("path") {
let path = PathBuf::from(path);
let data = std::fs::read_to_string(&path)?;
info!("Loaded import data from {:?}", path);
data
} else {
if atty::is(atty::Stream::Stdin) {
eprintln!("Attempting to import data from standard input, press Ctrl-D to finish.");
}
info!("Attempting to read import data from stdin...");
let data = read_import_data()?;
info!("Loaded {} bytes of import data from stdin", data.len());
data
}; so, for instance, |
Could you give what you're suggesting a try? I think you and |
I did try my suggestion before commenting. Have just done so again, still behaves exactly as I'd expect, so does your branch. If I give a filename or pipe something in, like from a file, I don't get the control+D message. If I leave it just attached to the terminal expecting input from that, I do get the message. Is that not what happens for you? Maybe we can screenshare on Monday so I can see what you're seeing. |
Could you share the exact command you used to get the Ctrl + D message path, please? |
|
[CHRON-323](https://blockchaintp.atlassian.net/browse/CHRON-323) Signed-off-by: Joseph Livesey <joseph.livesey@btp.works>
f56765f
to
1336d0d
Compare
Sorry! You were right! Don't know why I wasn't seeing it before. I made all your suggested changes. |
Improve information around stdin not being readable, quit if if it's not and standard in is not a tty.
CHRON-323