File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments