Hi, today I was testing (again) my software ( a tool to build a full linux system from scratch).
When my tool start to build Rustc, I had this error. To be honest, I don’t understand the problem.
(ISM Chroot) root:~# ism software install xorg-server
ChCChhCheCcCkCiDone !
Rustc /1.52.0/ { }
Xorg-Libraries /1.20.13/ { }
Js /78.13.0/ { }
Polkit /0.119.0/ { Linux-Pam Elogind }
Elogind /246.10.0/ { Openrc Linux-Pam Polkit }
Xorg-Server /1.20.13/ { Elogind Libepoxy Wayland-Protocols Acpid }
6 new softwares will be install
Would you like to install these softwares ?[y/n]y
<< [1 / 6] Installing Rustc /1.52.0/
Showing last frame. Use --error-trace for full trace.
There was a problem expanding macro 'macro_140340635089920'
Code in .ISM.task.cr:25:1
25 | {{ read_file("/usr/share/ism//ISM/Software.cr"
^
Called macro defined in .ISM.task.cr:25:1
25 | {{ read_file("/usr/share/ism//ISM/Software.cr"
Which expanded to:
> 547 | process = Process.run( arguments[0],
> 548 | args: arguments[1..arguments.size-1],
> 549 | output: :inherit,
^
Error: expected argument 'output' to 'Process.run' to be (IO | Process::Redirect), not Symbol
Overloads are:
- Process.run(command : String, args = nil, env : Env = nil, clear_env : Bool = false, shell : Bool = false, input : Stdio = Redirect::Close, output : Stdio = Redirect::Close, error : Stdio = Redirect::Close, chdir : Path | String | ::Nil = nil)
- Process.run(command : String, args = nil, env : Env = nil, clear_env : Bool = false, shell : Bool = false, input : Stdio = Redirect::Pipe, output : Stdio = Redirect::Pipe, error : Stdio = Redirect::Pipe, chdir : Path | String | ::Nil = nil, &)
The calling program is this one:
runPythonCommand( ["./x.py","build","--exclude","src/tools/miri"],
buildDirectoryPath,
{"RUSTFLAGS" => "-C link-args=-lffi"})
And this is the function where come from the error:
def runChrootTasks(chrootTasks) : Process::Status
File.write(Ism.settings.rootPath+ISM::Default::Filename::Task, chrootTasks)
process = Process.run("chmod", args: [ "+x",
"#{Ism.settings.rootPath}#{ISM::Default::Filename::Task}"],
output: :inherit,
error: :inherit,
shell: true)
process = Process.run("chroot", args: [ Ism.settings.rootPath,
"./#{ISM::Default::Filename::Task}"],
output: :inherit,
error: :inherit,
shell: true)
File.delete(Ism.settings.rootPath+ISM::Default::Filename::Task)
return process
end
def runSystemCommand(arguments = Array(String).new, path = String.new, environment = Hash(String, String).new) : Process::Status
environmentCommand = (environment.map { |key| key.join("=") }).join(" ")
if Ism.settings.installByChroot
chrootCommand = <<-CODE
#!/bin/bash
cd #{path} && #{environmentCommand} #{arguments.join(" ")}
CODE
process = runChrootTasks(chrootCommand)
else
process = Process.run( arguments[0],
args: arguments[1..arguments.size-1],
output: :inherit,
error: :inherit,
shell: true,
chdir: path,
env: environment)
end
return process
end
def runPythonCommand(arguments = Array(String).new, path = String.new, environment = Hash(String, String).new)
process = runSystemCommand(["python"]+arguments, path, environment)
if !process.success?
Ism.notifyOfRunSystemCommandError(arguments, path, environment)
Ism.exitProgram
end
end