| ... | @@ -66,7 +66,11 @@ fn main() -> Result<()> { | ... | @@ -66,7 +66,11 @@ fn main() -> Result<()> { |
| 66 | let cli = Cli::parse(); | 66 | let cli = Cli::parse(); |
| 67 | | 67 | |
| 68 | match cli.command { | 68 | match cli.command { |
| 69 | Commands::Compile { file, stdout, target: _ } => { | 69 | Commands::Compile { |
| | 70 | file, |
| | 71 | stdout, |
| | 72 | target: _, |
| | 73 | } => { |
| 70 | let contents = std::fs::read_to_string(file.clone()).unwrap(); | 74 | let contents = std::fs::read_to_string(file.clone()).unwrap(); |
| 71 | let result = transpile(contents.clone())?; | 75 | let result = transpile(contents.clone())?; |
| 72 | | 76 | |
| ... | @@ -85,35 +89,34 @@ fn main() -> Result<()> { | ... | @@ -85,35 +89,34 @@ fn main() -> Result<()> { |
| 85 | | 89 | |
| 86 | let rt = get_runtime(&target); | 90 | let rt = get_runtime(&target); |
| 87 | | 91 | |
| 88 | match rt.as_str() { | 92 | let command = match rt.as_str() { |
| 89 | "deno" => { | 93 | "deno" => { |
| 90 | let output = std::process::Command::new("deno") | 94 | std::process::Command::new("deno") |
| 91 | .arg("run") | 95 | .arg("run") |
| 92 | .arg("-A") | 96 | .arg("-A") |
| 93 | .arg(temp_file) | 97 | .arg(temp_file) |
| 94 | .output() | 98 | .spawn() |
| 95 | .expect("Failed to execute process"); | 99 | .expect("Failed to execute process") |
| 96 | println!("{}", String::from_utf8_lossy(&output.stdout)); | | |
| 97 | } | 100 | } |
| 98 | "node" => { | 101 | "node" => { |
| 99 | let output = std::process::Command::new("node") | 102 | std::process::Command::new("node") |
| 100 | .arg(temp_file) | 103 | .arg(temp_file) |
| 101 | .output() | 104 | .spawn() |
| 102 | .expect("Failed to execute process"); | 105 | .expect("Failed to execute process") |
| 103 | println!("{}", String::from_utf8_lossy(&output.stdout)); | | |
| 104 | } | 106 | } |
| 105 | "bun" => { | 107 | "bun" => { |
| 106 | let output = std::process::Command::new("bun") | 108 | std::process::Command::new("bun") |
| 107 | .arg("run") | 109 | .arg("run") |
| 108 | .arg(temp_file) | 110 | .arg(temp_file) |
| 109 | .output() | 111 | .spawn() |
| 110 | .expect("Failed to execute process"); | 112 | .expect("Failed to execute process") |
| 111 | println!("{}", String::from_utf8_lossy(&output.stdout)); | | |
| 112 | } | 113 | } |
| 113 | _ => { | 114 | _ => { |
| 114 | println!("Unknown runtime: {}", target); | 115 | println!("Unknown runtime: {}", target); |
| 115 | } | 116 | } |
| 116 | } | 117 | } |
| | 118 | |
| | 119 | command.wait().unwrap(); |
| 117 | } | 120 | } |
| 118 | } | 121 | } |
| 119 | | 122 | |