Skip to content

Commit 9bb43af

Browse files
authored
Filename fixes (#217)
The previous PR wasn't rebased, so it failed to compile, this PR fixes it.
1 parent b9ad359 commit 9bb43af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/shell/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ async fn main() -> miette::Result<()> {
186186

187187
if options.file.is_some() || options.command.is_some() {
188188
let script_text;
189+
let filename: Option<String>;
189190
if options.file.is_some() {
190-
script_text = std::fs::read_to_string(options.file.unwrap()).unwrap();
191+
script_text = std::fs::read_to_string(options.file.clone().unwrap()).unwrap();
192+
filename = Some(options.file.unwrap().display().to_string());
191193
} else if options.command.is_some() {
192194
script_text = options.command.unwrap();
195+
filename = None;
193196
} else {
194197
panic!();
195198
}
@@ -198,7 +201,7 @@ async fn main() -> miette::Result<()> {
198201
debug_parse(&script_text);
199202
return Ok(());
200203
}
201-
let exit_code = execute(&script_text, Some(file.display().to_string()), &mut state).await?;
204+
let exit_code = execute(&script_text, filename, &mut state).await?;
202205
if options.interact {
203206
interactive(Some(state), options.norc).await?;
204207
}

0 commit comments

Comments
 (0)