from collections import List
from sys.ffi import external_call
alias system = external_call["system", Int, StringLiteral]
fn run_commands(arg0: String, args: List[String]) -> Int:
var command: String = arg0
for arg in args:
command += " " + arg[]
return system(command) # invalid indirect call: argument #0 cannot be converted from 'String' to 'StringLiteral'
fn system2(arg0: String, args: List[String]) -> Int:
var command: String = arg0
for arg in args:
command += " " + arg[] # Access the element inside the list
return external_call["system", Int, String](command)
fn main():
# var args = List[String]("kill", "-9", "$(lsof -t -i :8000)")
var args = List[String]("ls")
_ = run_commands(args[0], args[1:])
_ = system2(args[0], args[1:])
from collections import List
from sys.ffi import external_call
alias system = external_call["system", Int, StringLiteral]
fn run_commands(arg0: String, args: List[String]) -> Int:
var command: String = arg0
for arg in args:
command += " " + arg[]
return system(command) # invalid indirect call: argument #0 cannot be converted from 'String' to 'StringLiteral'
fn system2(arg0: String, args: List[String]) -> Int:
var command: String = arg0
for arg in args:
command += " " + arg[] # Access the element inside the list
return external_call["system", Int, String](command)
fn main():
# var args = List[String]("kill", "-9", "$(lsof -t -i :8000)")
var args = List[String]("ls")
_ = run_commands(args[0], args[1:])
_ = system2(args[0], args[1:])